Merge branch 'szzh' into dev_hjq

This commit is contained in:
ouyangxuhua 2015-11-03 17:22:05 +08:00
commit b127eadb9d
295 changed files with 9518 additions and 1006 deletions

1
.gitignore vendored
View File

@ -29,3 +29,4 @@ vendor/cache
/public/images/avatars
/public/files
/tags
/config/initializers/gitlab_config.rb

View File

@ -6,7 +6,8 @@ unless RUBY_PLATFORM =~ /w32/
gem 'iconv'
end
gem 'grack', path:'./lib/grack'
gem 'grack', path:'lib/grack'
gem 'gitlab', path: 'lib/gitlab-cli'
gem 'rest-client'
gem "mysql2", "= 0.3.18"
gem 'redis-rails'
@ -45,7 +46,7 @@ group :development, :test do
gem 'pry-stack_explorer'
if RUBY_PLATFORM =~ /darwin/
gem 'puma'
end
end
end
gem 'rspec-rails', '~> 3.0'

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the organizations controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -354,7 +354,7 @@ class AdminController < ApplicationController
@schools = School.where('1=1')
end
@school_count = @schools.count
@school_pages = Paginator.new @school_count, per_page_option, params['page'] || 1
@school_pages = Paginator.new @school_count, 100, params['page'] || 1
@schools = paginateHelper @schools,100
respond_to do |format|
format.html

View File

@ -38,7 +38,8 @@ class ApplicationController < ActionController::Base
protect_from_forgery
def handle_unverified_request
super
cookies.delete(autologin_cookie_name)
raise(ActionController::InvalidAuthenticityToken)
# cookies.delete(autologin_cookie_name)
end
before_filter :find_first_page
@ -381,6 +382,11 @@ class ApplicationController < ActionController::Base
if allowed
true
else
if params[:action] == 'show'
#更新申请结果反馈消息的状态
messages = CourseMessage.where("course_message_type =? and course_id =? and user_id =? and viewed =?", 'CourseRequestDealResult', @course.id, User.current.id, false)
messages.update_all(:viewed => true)
end
if @course && @course.archived?
render_403 :message => :notice_not_authorized_archived_project
else

View File

@ -227,6 +227,8 @@ class AttachmentsController < ApplicationController
format.js
elsif @attachment.container.is_a?(Message)
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
elsif @attachment.container.is_a?(BlogComment)
format.html { redirect_to_referer_or user_blog_blog_comment_path(:user_id=>@attachment.container.author.id,:blog_id=>@attachment.container.blog_id,:id=>@attachment.container.id)}
elsif @course.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
else

View File

@ -0,0 +1,150 @@
class BlogCommentsController < ApplicationController
include ApplicationHelper
before_filter :find_user
def index
end
def create
if User.current.logged?
@article = BlogComment.new
@article.author = User.current
@article.blog_id = params[:blog_id]
@article.safe_attributes = params[:blog_comment]
if request.post?
@article.save_attachments(params[:attachments])
if @article.save
# 更新kindeditor上传的图片资源所有者
# if params[:asset_id]
# ids = params[:asset_id].split(',')
# update_kindeditor_assets_owner ids,@article.id,OwnerTypeHelper::BLOGCOMMENT
# end
render_attachment_warning_if_needed(@article)
else
end
redirect_to user_blogs_path(:user_id=>params[:user_id])
else
respond_to do |format|
format.html {
render :layout => 'new_base_user'
}
end
end
else
redirect_to signin_path
end
end
def new
respond_to do |format|
format.html {render :layout=>'new_base_user'}
end
end
def show
@article = BlogComment.find(params[:id])
respond_to do |format|
format.html {render :layout=>'new_base_user'}
end
end
def update
@article = BlogComment.find(params[:id])
@article.safe_attributes = params[:blog_comment]
@article.save_attachments(params[:attachments])
if @article.save
render_attachment_warning_if_needed(@article)
else
end
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
end
def destroy
@article = BlogComment.find(params[:id])
if @article.parent_id.nil? #如果是文章被删那么跳转到用户博客界面如果带了course_id过来那么就要跳转到课程首页
if params[:course_id] #如果带了课程id过来说明这是课程大纲不要删除只需取消课程大纲就ok了
@course = Course.find(params[:course_id])
@course.outline = 0
@course.save
redirect_to course_path(:id=>params[:course_id])
else
@article.children.delete
@article.delete
redirect_to user_blogs_path(:user_id=>User.current)
end
else#如果是回复被删,
if params[:course_id] #如果带了course_id过来了那么这是要跳到课程大纲去的
@article.delete
redirect_to syllabus_course_path(:id=>params[:course_id])
else
root = @article.root
@article.delete
redirect_to user_blog_blog_comment_path(:user_id=>root.author_id,:blog_id=>root.blog_id,:id=>root.id)
end
end
end
def edit
@article = BlogComment.find(params[:id])
respond_to do |format|
format.html {render :layout=>'new_base_user'}
end
end
def quote
@blogComment = BlogComment.find(params[:id])
@subject = @blogComment.title
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
@content = "> #{ll(Setting.default_language, :text_user_wrote, @blogComment.author.realname)}\n> "
@temp = BlogComment.new
@course_id = params[:course_id]
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @blogComment.author.realname)} <br/>#{@blogComment.content.html_safe}</blockquote>".html_safe
respond_to do | format|
format.js
end
end
#回复
def reply
if params[:in_user_center]
@in_user_center = true
end
@article = BlogComment.find(params[:id]).root
@quote = params[:quote][:quote]
@blogComment = BlogComment.new
@blogComment.author = User.current
@blogComment.blog = Blog.find(params[:blog_id])
params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0
params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0
@blogComment.safe_attributes = params[:blog_comment]
@blogComment.content = @quote + @blogComment.content
@blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
@article.children << @blogComment
@user_activity_id = params[:user_activity_id]
user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
attachments = Attachment.attach_files(@blogComment, params[:attachments])
render_attachment_warning_if_needed(@blogComment)
#@article.save
# redirect_to user_blogs_path(:user_id=>params[:user_id])
respond_to do |format|
format.html {
if params[:course_id] #如果呆了course_id过来了那么这是要跳到课程大纲去的
redirect_to syllabus_course_path(:id=>params[:course_id])
else
redirect_to user_blog_blog_comment_path(:user_id=>@article.author_id,:blog_id=>@article.blog_id,:id=>@article)
end
}
format.js
end
rescue Exception => e #如果上面的代码执行发生异常就捕获
flash[:notice] = e.message
end
private
def find_user
@user = User.find(params[:user_id])
end
end

View File

@ -0,0 +1,47 @@
class BlogsController < ApplicationController
before_filter :find_blog,:except => [:index,:create,:new]
before_filter :find_user
def index
@articls = @user.blog.articles
@article = BlogComment.new
respond_to do |format|
format.html {render :layout=>'new_base_user'}
end
end
def create
end
def new
end
def show
end
def update
end
def destory
end
def edit
end
private
def find_blog
if params[:blog_id]
@blog = Blog.find(params[:blog_id])
else
render_404
end
if @blog.nil?
#如果某个user的blog不存在那么就创建一条
@blog = Blog.create(:name=>User.find(params[:id]).realname ,
:description=>'',
:author_id=>params[:id])
end
end
def find_user
@user = User.find(params[:user_id])
end
end

View File

@ -31,17 +31,16 @@ class CoursesController < ApplicationController
def join
if User.current.logged?
if params[:role] == 10
cs = CoursesService.new
@user = User.current
join = cs.join_course params,user
join = cs.join_course params,@user
@state = join[:state]
@course = join[:course]
else
@course = Course.find_by_id params[:object_id]
CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest')
@state = 6
end
# else
# @course = Course.find_by_id params[:object_id]
# CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest')
# @state = 6
# end
else
@state = 5 #未登录
end
@ -108,7 +107,7 @@ class CoursesController < ApplicationController
courses = Course.visible
@courses = paginateHelper courses,10
else
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'")
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc")
@courses = paginateHelper courses,10
end
@name = params[:name]
@ -289,14 +288,11 @@ class CoursesController < ApplicationController
def export_course_member_excel
@all_members = student_homework_score(0,0,0,"desc")
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
# 如果是ie 需要转码
if(/trident/.match(request.env["HTTP_USER_AGENT"]) != nil)
filename= URI::encode(filename)
end
respond_to do |format|
format.xls {
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{filename}.xls")
:filename => filename_for_content_disposition("#{filename}.xls"))
}
end
end
@ -617,6 +613,10 @@ class CoursesController < ApplicationController
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
create_course_messages.update_all(:viewed => true)
#更新申请结果反馈消息的状态
course_request_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @course.id, 'CourseRequestDealResult', false)
course_request_messages.update_all(:viewed => true)
course_activities = @course.course_activities
@canShowRealName = User.current.member_of_course? @course
@page = params[:page] ? params[:page].to_i + 1 : 0
@ -711,6 +711,41 @@ class CoursesController < ApplicationController
end
end
#从课程创建的老师那里选择课程大纲
def course_outline
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles
@is_in_show_outline_page = params[:is_in_show_outline_page]
respond_to do |format|
format.js
end
end
#根据关键字搜索,查找方法一样的,但返回内容不一样
def search_course_outline
@article_title = params[:title]
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles.like(@article_title)
render :json=>@blog_articles.to_json
end
#设置或者更改课程的大纲
def set_course_outline
@course.outline = params[:outline_id]
@course.save
@is_in_show_outline_page = params[:is_in_show_outline_page]
respond_to do |format|
format.js
end
end
#显示课程大纲
def syllabus
@article = BlogComment.find(@course.outline)
respond_to do |format|
format.html {render :layout => 'base_courses'}
end
end
#删除课程
#删除课程只是将课程的is_delete状态改为falseis_delete为false状态的课程只有管理员可以看到
def destroy

View File

@ -42,8 +42,8 @@ class GanttsController < ApplicationController
respond_to do |format|
format.html { render :action => "show", :layout => 'base_projects' }#by young
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
format.pdf { send_data(@gantt.to_pdf, :type => 'application/pdf', :filename => "#{basename}.pdf") }
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => filename_for_content_disposition("#{basename}.png")) } if @gantt.respond_to?('to_image')
format.pdf { send_data(@gantt.to_pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{basename}.pdf") ) }
end
end
end

View File

@ -33,7 +33,7 @@ class HomeworkAttachController < ApplicationController
format.js
format.xls {
send_data(homework_to_xls(@all_homework_list), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@bid.name}#{l(:excel_homework_list)}(#{l(:excel_not_rated)}).xls")
:filename => filename_for_content_disposition("#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@bid.name}#{l(:excel_homework_list)}(#{l(:excel_not_rated)}).xls") )
}
end
end
@ -66,7 +66,7 @@ class HomeworkAttachController < ApplicationController
format.js
format.xls {
send_data(homework_to_xls(all_homework_list), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@bid.name}#{l(:excel_homework_list)}(#{l(:excel_been_rated)}).xls")
:filename => filename_for_content_disposition("#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@bid.name}#{l(:excel_homework_list)}(#{l(:excel_been_rated)}).xls") )
}
end
end
@ -101,7 +101,7 @@ class HomeworkAttachController < ApplicationController
format.js
format.xls {
send_data(homework_to_xls(all_homework_list), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@bid.name}#{l(:excel_homework_list)}.xls")
:filename => filename_for_content_disposition("#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@bid.name}#{l(:excel_homework_list)}.xls") )
}
end
end

View File

@ -6,8 +6,8 @@ class HomeworkCommonController < ApplicationController
include StudentWorkHelper
before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set]
before_filter :member_of_course, :only => [:index]
def index
@ -47,10 +47,18 @@ class HomeworkCommonController < ApplicationController
if params[:homework_common]
@homework.name = params[:homework_common][:name]
@homework.description = params[:homework_common][:description]
if params[:homework_common][:publish_time] == ""
@homework.publish_time = Date.today
else
@homework.publish_time = params[:homework_common][:publish_time]
end
@homework.end_time = params[:homework_common][:end_time] || Time.now
@homework.course_id = params[:course_id]
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
homework_detail_manual.comment_status = 1
end
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
@ -215,6 +223,16 @@ class HomeworkCommonController < ApplicationController
end
end
#评分设置
def score_rule_set
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course]
end
private
#获取课程
def find_course

View File

@ -151,7 +151,7 @@ class IssuesController < ApplicationController
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
format.pdf {
pdf = issue_to_pdf(@issue, :journals => @journals)
send_data(pdf, :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf")
send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") )
}
end
end

View File

@ -159,6 +159,14 @@ class MembersController < ApplicationController
if role && (role.name == "学生" || role.name == "Student")
StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id)
end
#给新成员和老师发送加入课程的消息发送者id放在CourseMessage的course_message_id字段中
#course_message_type设置为JoinCourse
#status = 0 表示给学生发status = 1表示给老师发
course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :content => role, :viewed => false, :status => 0)
course_join.save
CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse",:content => role, :viewed => false, :status => 1)
members << member
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
if (params[:membership][:role_ids])
@ -305,7 +313,8 @@ class MembersController < ApplicationController
grade.destroy
end
end
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
#移出项目发送消息
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
end
respond_to do |format|
format.html { redirect_to_settings_in_projects }
@ -333,6 +342,8 @@ class MembersController < ApplicationController
end
@roles = Role.givable.all[3..5]
@members = @course.member_principals.includes(:roles, :principal).all.sort
#移出课程发送消息
CourseMessage.create(:user_id => @member.user_id, :course_id => @course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => User.current.id)
end
respond_to do |format|
format.html { redirect_to_settings_in_courses }

View File

@ -1,55 +0,0 @@
class OrganizationController < ApplicationController
# layout 'base_projects'
before_filter :require_admin, :except => [:index]
def index
#@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)")
@organizations = Organization.all
respond_to do |format|
format.html
end
end
def new
@organizations = Organization.new
respond_to do |format|
format.html
end
end
def create
@organizations = Organization.new
@organizations.name = params[:organization][:name]
if @organizations.save
redirect_to admin_organization_url
end
end
def edit
@organization = Organization.find params[:id]
respond_to do |format|
format.html
end
rescue Exception => e
render_404
end
def update
@organization = Organization.find params[:id]
@organization.name = params[:organization][:name]
if @organization.save
redirect_to admin_organization_url
end
rescue Exception => e
render_404
end
def destroy
@organization = Organization.find params[:id]
if @organization.destroy
redirect_to admin_organization_url
end
rescue Exception => e
render_404
end
end

View File

@ -0,0 +1,27 @@
class OrganizationsController < ApplicationController
layout 'base_org'
def new
@organization = Organization.new
render :layout => 'new_base'
end
def create
@organization = Organization.new
@organization.name = params[:organization][:name]
@organization.description = params[:organization][:description]
@organization.is_public = params[:organization][:is_public]
@organization.creator_id = User.current.id
member = OrgMember.new(:user_id => User.current.id, :role => 'Manager')
@organization.org_members << member
if @organization.save
redirect_to organization_path(@organization)
end
end
def show
end
def update
end
end

View File

@ -413,7 +413,7 @@ class PollController < ApplicationController
respond_to do |format|
format.xls {
send_data(poll_to_xls(poll_questions), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@poll.polls_name}.xls")
:filename => filename_for_content_disposition("#{@poll.polls_name}.xls") )
}
end
end

View File

@ -29,12 +29,12 @@ class RepositoriesController < ApplicationController
menu_item :repository
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
default_search_scope :changesets
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo]
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo,:to_gitlab]
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab]
accept_rss_auth :revisions
# hidden repositories filter // 隐藏代码过滤器
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
@ -42,7 +42,7 @@ class RepositoriesController < ApplicationController
include RepositoriesHelper
helper :project_score
#@root_path = RepositoriesHelper::ROOT_PATH
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
def new
@ -62,8 +62,8 @@ class RepositoriesController < ApplicationController
end
end
def newrepo
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@ -76,23 +76,23 @@ class RepositoriesController < ApplicationController
render :layout => 'base_projects'
end
end
def fork
@repository_url = params[:repository_url]
# @repository.url
# system "htpasswd -mb "+@root_path+"user.passwd "+params[:repository][:identifier]+" "+@upasswd
# system "echo -e '"+params[:project_id]+"-"+params[:repository][:identifier]+"-write:"+
# " "+params[:repository][:identifier]+"' >> "+@root_path+"group.passwd"
system "git clone --bare "+@repository_url
# " "+params[:repository][:identifier]+"' >> "+@root_path+"group.passwd"
system "git clone --bare "+@repository_url
# system "mv "+@project_path+"/hooks/post-update{.sample,}"
# system "chmod a+x "+@project_path+"/hooks/post-update"
# system "."+@project_path+"/hooks/post-update"
# system "echo -e 'Allow from all \n Order Deny,Allow \n "+
# "<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
# "Require group "+params[:project_id]+"-"+params[:repository][:identifier]+"-write \n "+
# "</Limit> \n ' >>"+
# @project_path+"/.htaccess"
# "<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
# "Require group "+params[:project_id]+"-"+params[:repository][:identifier]+"-write \n "+
# "</Limit> \n ' >>"+
# @project_path+"/.htaccess"
flash[:notice] = l(:label_notice_fork_successed)
@repositories = @project.repositories
render :action => 'show', :layout => 'base_projects'
@ -115,77 +115,24 @@ update
}
def create
if params[:repository_scm].to_s == 'Gitlab'
# add by nwb
# 增加对gitlab版本库的支持
attrs = pickup_extra_info
@repository = Repository.factory('Git')
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
@repository.project = @project
if request.post? && @repository.save
redirect_to settings_project_url(@project, :tab => 'repositories')
else
redirect_to settings_project_url(@project, :tab => 'repositories')
end
else # 原逻辑
##xianbo
@root_path=RepositoriesHelper::ROOT_PATH
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@project_path=@root_path+"htdocs/"+@repository_name
@repository_tag=params[:repository][:upassword] || params[:repository][:password]
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
logger.info "htpasswd -mb "+@root_path+"htdocs/user.passwd "+@repo_name+": "+@repository_tag
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
attrs = pickup_extra_info
if((@repository_tag!="")&&params[:repository_scm]=="Git")
params[:repository][:url]=@project_path
end
###xianbo
@repository = Repository.factory(params[:repository_scm])
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
@repository.project = @project
if request.post? && @repository.save
if(params[:repository_scm]=="Git")
system "htpasswd -mb "+@root_path+"htdocs/user.passwd "+@repo_name+" "+@repository_tag
system "echo -e '"+@repo_name+"-write:"+
" "+@repo_name+"' >> "+@root_path+"htdocs/group.passwd"
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
system "git init --bare "+@project_path
system "mv "+@project_path+"/hooks/post-update{.sample,}"
system "chmod a+x "+@project_path+"/hooks/post-update"
system "echo -e 'Allow from all \n Order Deny,Allow \n "+
"<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
"Require group "+@repo_name+"-write \n "+
"</Limit> \n ' >> "+
@root_path+"htdocs/"+ @repository_name+"/.htaccess"
system "cd "+@project_path+" ;git update-server-info"
File.open(@project_path+"/hooks/post-update", "w+") do |f|
f.write(HOOK_TEMPLATE)
end
@repository.update_attributes(:login => User.current.login.to_s)
end
redirect_to settings_project_url(@project, :tab => 'repositories',:repository_error_message=>@repository.errors.full_messages)
else if(@repository_tag.blank?)
#render :action => 'newrepo', :layout =>'base_projects'
redirect_to settings_project_url(@project, :tab => 'repositories',:repository => "pswd_is_null",:repository_error_message=>@repository.errors.full_messages)
else
redirect_to settings_project_url(@project, :tab => 'repositories',:repository => @repository,:repository_error_message=>@repository.errors.full_messages)
end
end
attrs = pickup_extra_info
@repository = Repository.factory('Git')
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
@repository.project = @project
@repository.type = 'Repository::Gitlab'
@repository.url = @repository.identifier
if request.post? && @repository.save
s = Trustie::Gitlab::Sync.new
s.create_project(@project, @repository)
redirect_to settings_project_url(@project, :tab => 'repositories')
else
redirect_to settings_project_url(@project, :tab => 'repositories',:repository_error_message=>@repository.errors.full_messages)
end
end
def edit
end
@ -228,15 +175,17 @@ update
# Build a hash with repository usernames as keys and corresponding user ids as values
@repository.committer_ids = params[:committers].values.inject({}) {|h, c| h[c.first] = c.last; h}
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_url(@project, :tab => 'repositories')
respond_to do |format|
format.html{
render :layout => "base_projects"
}
end
elsif request.get?
respond_to do |format|
format.html{
render :layout => "base_projects"
}
end
respond_to do |format|
format.html{
render :layout => "base_projects"
}
end
end
end
@ -247,6 +196,16 @@ update
redirect_to settings_project_url(@project, :tab => 'repositories')
end
def to_gitlab
@project = Project.find(params[:project_id])
@repository = Repository.find(params[:id])
s = Trustie::Gitlab::Sync.new
s.sync_project(@project, path: params[:repo_name], import_url: @repository.url)
@repository.type = 'Repository::Gitlab'
@repository.save
redirect_to :controller => 'repositories', :action => 'show', :id => @project.id, to: 'gitlab'
end
def show
## TODO: the below will move to filter, done.
if !User.current.member_of?(@project)
@ -256,19 +215,23 @@ update
end
end
if params[:to] == 'gitlab'
g = Gitlab.client
g.post('/session', body: {email: User.current.mail, password: User.current.hashed_password})
redirect_to "http://192.168.41.130:3000/gitlab-org/gitlab-shell/tree/master"
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?
# g = Gitlab.client
# project = g.project(20)
# rr = g.trees(project.id, @path)
# r = g.get ("/projects/#{@project}/repository/tree")
# :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
@ -276,15 +239,25 @@ update
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
#Modified by young
# (show_error_not_found; return) unless @entries
@changesets = @repository.latest_changesets(@path, @rev)
# (show_error_not_found; return) unless @entries
g = Gitlab.client
@changesets = g.get ("/projects/#{@project.gpid}/repository/commits")
# @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_count = @changesets.count
@changesets_latest_coimmit = @changesets[0]
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@course_tag = params[:course]
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
ip = RepositoriesHelper::REPO_IP_ADDRESS
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+
@repository.url.slice(project_path_cut, @repository.url.length).to_s
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"
else
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+
@repository.url.slice(project_path_cut, @repository.url.length).to_s
end
if @course_tag == 1
render :action => 'show', :layout => 'base_courses'
else
@ -298,7 +271,9 @@ update
def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
g = Gitlab.client
@changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
#@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
@properties = @repository.properties(@path, @rev)
@changeset = @repository.find_changeset_by_name(@rev)
render :layout => 'base_projects'
@ -310,10 +285,10 @@ update
per_page_option,
params['page']
@changesets = @repository.changesets.
limit(@changeset_pages.per_page).
offset(@changeset_pages.offset).
includes(:user, :repository, :parents).
all
limit(@changeset_pages.per_page).
offset(@changeset_pages.offset).
includes(:user, :repository, :parents).
all
respond_to do |format|
format.html { render :layout => 'base_projects' }
@ -327,6 +302,7 @@ update
def entry
entry_and_raw(false)
render :layout => 'base_projects'
end
def entry_and_raw(is_raw)
@ -339,8 +315,8 @@ update
@content = @repository.cat(@path, @rev)
(show_error_not_found; return) unless @content
if is_raw ||
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
! is_entry_text_data?(@content, @path)
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
! is_entry_text_data?(@content, @path)
# Force the download
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
send_type = Redmine::MimeType.of(@path)
@ -423,8 +399,8 @@ update
filename = "changeset_r#{@rev}"
filename << "_r#{@rev_to}" if @rev_to
send_data @diff.join, :filename => "#{filename}.diff",
:type => 'text/x-patch',
:disposition => 'attachment'
:type => 'text/x-patch',
:disposition => 'attachment'
else
@diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
@diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
@ -435,7 +411,7 @@ update
User.current.preference.save
end
@cache_key = "repositories/diff/#{@repository.id}/" +
Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
unless read_fragment(@cache_key)
@diff = @repository.diff(@path, @rev, @rev_to)
unless @diff
@ -462,16 +438,16 @@ update
def graph
data = nil
case params[:graph]
when "commits_per_month"
data = graph_commits_per_month(@repository)
when "commits_per_author"
data = graph_commits_per_author(@repository)
when "author_commits_per_month"
data = graph_author_commits_per_month(@repository)
when "author_commits_six_month"
data = author_commits_six_month(@repository)
when "author_code_six_months"
data = author_code_six_month(@repository)
when "commits_per_month"
data = graph_commits_per_month(@repository)
when "commits_per_author"
data = graph_commits_per_author(@repository)
when "author_commits_per_month"
data = graph_author_commits_per_month(@repository)
when "author_commits_six_month"
data = author_commits_six_month(@repository)
when "author_code_six_months"
data = author_code_six_month(@repository)
end
if data
headers["Content-Type"] = "image/svg+xml"
@ -551,14 +527,14 @@ update
@date_from = @date_to << 11
@date_from = Date.civil(@date_from.year, @date_from.month, 1)
commits_by_day = Changeset.count(
:all, :group => :commit_date,
:conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
:all, :group => :commit_date,
:conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_month = [0] * 12
commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
changes_by_day = Change.count(
:all, :group => :commit_date, :include => :changeset,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
:all, :group => :commit_date, :include => :changeset,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
changes_by_month = [0] * 12
changes_by_day.each {|c| changes_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
@ -566,26 +542,26 @@ update
12.times {|m| fields << month_name(((Date.today.month - 1 - m) % 12) + 1)}
graph = SVG::Graph::Bar.new(
:height => 300,
:width => 600,
:fields => fields.reverse,
:stack => :side,
:scale_integers => true,
:step_x_labels => 2,
:show_data_values => true,
:graph_title => l(:label_commits_per_month),
:show_graph_title => true
:height => 300,
:width => 600,
:fields => fields.reverse,
:stack => :side,
:scale_integers => true,
:step_x_labels => 2,
:show_data_values => true,
:graph_title => l(:label_commits_per_month),
:show_graph_title => true
)
# 具状图
graph.add_data(
:data => commits_by_month[0..11].reverse,
:title => l(:label_revision_plural)
:data => commits_by_month[0..11].reverse,
:title => l(:label_revision_plural)
)
graph.add_data(
:data => changes_by_month[0..11].reverse,
:title => l(:label_change_plural)
:data => changes_by_month[0..11].reverse,
:title => l(:label_change_plural)
)
graph.burn
@ -610,23 +586,23 @@ update
fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
graph = SVG::Graph::BarHorizontal.new(
:height => 400,
:width => 600,
:fields => fields,
:stack => :side,
:scale_integers => true,
:show_data_values => true,
:rotate_y_labels => false,
:graph_title => l(:label_commits_per_author),
:show_graph_title => true
:height => 400,
:width => 600,
:fields => fields,
:stack => :side,
:scale_integers => true,
:show_data_values => true,
:rotate_y_labels => false,
:graph_title => l(:label_commits_per_author),
:show_graph_title => true
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_plural)
:data => commits_data,
:title => l(:label_revision_plural)
)
graph.add_data(
:data => changes_data,
:title => l(:label_change_plural)
:data => changes_data,
:title => l(:label_change_plural)
)
graph.burn
end
@ -637,7 +613,7 @@ update
@date_from = @date_to << 12
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:all, :group => :committer,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25)
fields = commits_by_author.collect {|r| r.first}

View File

@ -84,7 +84,7 @@ class StoresController < ApplicationController
respond_to do |format|
format.xls {
send_data(homework_to_xls(attachments), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{l(:label_file_lost_list)}.xls")
:filename => filename_for_content_disposition("#{l(:label_file_lost_list)}.xls") )
}
end
end

View File

@ -108,6 +108,7 @@ class StudentWorkController < ApplicationController
else
@stundet_works = []
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
else
if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
@ -128,6 +129,7 @@ class StudentWorkController < ApplicationController
else
@stundet_works = []
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name).count
end
@score = @b_sort == "desc" ? "asc" : "desc"
@ -456,8 +458,14 @@ class StudentWorkController < ApplicationController
student_work.save
end
end
respond_to do |format|
format.html{redirect_to student_work_index_url(:homework => @homework.id)}
if params[:student_path]
redirect_to student_work_index_url(:homework => @homework.id)
else
@user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course]
respond_to do |format|
format.js
end
end
end

View File

@ -239,6 +239,46 @@ class UsersController < ApplicationController
end
end
#处理加入课程成为教辅教师的请求
#status 1 同意 2 拒绝
def dealwith_apply_request
@msg = CourseMessage.find(params[:msg_id])
#CourseMessage content存的是role 7教辅 9 教师
case params[:agree]
when 'Y'
apply_user = User.find(@msg.course_message_id)
if apply_user.member_of_course?(Course.find(@msg.course_id))
#将角色改为老师或者教辅
member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0]
member.role_ids = [@msg.content] # msg content保存的是申请的职位角色
#删除为学生的记录
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
joined.each do |join|
join.delete
end
member.course_group_id = 0
member.save
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
else
members = []
members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id)
Course.find(@msg.course_id).members << members
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
end
when 'N'
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
@msg.update_attributes(:status=>2,:viewed=>1)
end
respond_to do |format|
format.js
end
end
# added by bai
def show_score
@ -328,7 +368,21 @@ class UsersController < ApplicationController
if User.current == @user
@page = params[:page] ? params[:page].to_i + 1 : 0
user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
#判断当前用户在当前课程的身份
visibleCourse = @user.courses.empty? ? [] : @user.courses.visible
homework_ids = []
visibleCourse.each do |course|
if User.current.allowed_to?(:as_teacher,course)
homeworks = HomeworkCommon.where("course_id = #{course.id}")
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
else
homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'")
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
end
end
visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")"
@homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10)
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
@is_in_course = params[:is_in_course].to_i || 0
respond_to do |format|
@ -453,8 +507,12 @@ class UsersController < ApplicationController
homework = HomeworkCommon.new
homework.name = params[:homework_common][:name]
homework.description = params[:homework_common][:description]
homework.end_time = params[:homework_common][:end_time] || Time.now
homework.publish_time = Time.now
homework.end_time = params[:homework_common][:end_time] || Date.today
if params[:homework_common][:publish_time] == ""
homework.publish_time = Date.today
else
homework.publish_time = params[:homework_common][:publish_time]
end
homework.homework_type = params[:homework_type].to_i || 1
homework.late_penalty = 10
homework.teacher_priority = 1
@ -466,7 +524,11 @@ class UsersController < ApplicationController
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
homework_detail_manual.comment_status = 1
if homework.publish_time > Date.today
homework_detail_manual.comment_status = 0
else
homework_detail_manual.comment_status = 1
end
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? homework.end_time + 7 : params[:evaluation_start]
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
@ -878,6 +940,12 @@ class UsersController < ApplicationController
end
def show
#更新用户申请成为课程老师或教辅消息的状态
if params[:course_id] != nil
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
join_course_messages.update_all(:viewed => true)
end
@page = params[:page] ? params[:page].to_i + 1 : 0
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
@ -903,10 +971,19 @@ class UsersController < ApplicationController
when "current_user"
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10)
else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
end
else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
end
# @user_activities = paginateHelper @user_activities,500
@type = params[:type]

View File

@ -82,14 +82,14 @@ class WikiController < ApplicationController
@content = @page.content_for_version(params[:version])
if User.current.allowed_to?(:export_wiki_pages, @project)
if params[:format] == 'pdf'
send_data(wiki_page_to_pdf(@page, @project), :type => 'application/pdf', :filename => "#{@page.title}.pdf")
send_data(wiki_page_to_pdf(@page, @project), :type => 'application/pdf', :filename => filename_for_content_disposition("#{@page.title}.pdf") )
return
elsif params[:format] == 'html'
export = render_to_string :action => 'export', :layout => false
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
send_data(export, :type => 'text/html', :filename => filename_for_content_disposition("#{@page.title}.html"))
return
elsif params[:format] == 'txt'
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
send_data(@content.text, :type => 'text/plain', :filename => filename_for_content_disposition("#{@page.title}.txt") )
return
end
end
@ -286,7 +286,7 @@ class WikiController < ApplicationController
send_data(export, :type => 'text/html', :filename => "wiki.html")
}
format.pdf {
send_data(wiki_pages_to_pdf(@pages, @project), :type => 'application/pdf', :filename => "#{@project.identifier}.pdf")
send_data(wiki_pages_to_pdf(@pages, @project), :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}.pdf") )
}
end
end

View File

@ -243,7 +243,45 @@ class WordsController < ApplicationController
flash[:error] = feedback.errors.full_messages[0]
redirect_to course_feedback_url(params[:id])
end
end
#作业的回复
def leave_homework_message
if User.current.logged?
@user = User.current
@homework_common = HomeworkCommon.find(params[:id]);
if params[:homework_message].size>0 && User.current.logged? && @user
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id])
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
end
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework_common.id}").first
if course_activity
course_activity.updated_at = Time.now
course_activity.save
end
user_activity = UserActivity.where("act_type='HomeworkCommon' and act_id =#{@homework_common.id}").first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
respond_to do |format|
format.js{
@user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course]
@homework_common_id = params[:homework_common_id]
}
end
else
flash[:error] = feedback.errors.full_messages[0]
end
end
else
render_403
end
end
def add_brief_introdution

View File

@ -2355,14 +2355,16 @@ module ApplicationHelper
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
end
end
end

View File

@ -0,0 +1,2 @@
module BlogCommentsHelper
end

View File

@ -0,0 +1,2 @@
module BlogsHelper
end

View File

@ -36,7 +36,7 @@ module CoursesHelper
#生成课程老师成员链接
def course_teacher_link teacher_num
if User.current.member_of_course?(@course) || User.current.admin?
link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'info_foot_num c_blue'
link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'info_foot_num c_blue', :id => 'teacher_number'
else
content_tag 'span',teacher_num, :class => 'info_foot_num c_blue'
end
@ -45,7 +45,7 @@ module CoursesHelper
#生成课程学生列表连接
def course_student_link student_num
if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin?
link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'info_foot_num c_blue'
link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'info_foot_num c_blue', :id => "student_number"
else
content_tag 'span',student_num, :class => 'info_foot_num c_blue'
end
@ -628,10 +628,10 @@ module CoursesHelper
#重启、关闭课程按钮
def set_course_time course
id = "finish_course_#{course.id}"
linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
# id = "finish_course_#{course.id}"
# linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
# desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
# link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
end
#加入课程、退出课程按钮

View File

@ -1,2 +1,2 @@
module EnterprisesHelper
module OrganizationsHelper
end

View File

@ -7,4 +7,5 @@ module OwnerTypeHelper
BID = 6
JOURNALSFORMESSAGE = 7
HOMEWORKCOMMON = 8
BLOGCOMMENT=9
end

View File

@ -25,6 +25,7 @@ module RepositoriesHelper
end
PROJECT_PATH_CUT = 40
REPO_IP_ADDRESS = Setting.host_repository
REPO_GITLAB_ADDRESS = "git.trustie.net"
def format_revision(revision)
if revision.respond_to? :format_identifier
@ -34,12 +35,21 @@ module RepositoriesHelper
end
end
def repository_creater rep
repository_creater = User.find_by_login(rep.login) unless rep.login.nil?
end
def truncate_at_line_break(text, length = 255)
if text
text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...')
end
end
def user_commit_rep(mail)
user = User.find_by_mail(mail)
user.nil? ? User.find(2) : User.find_by_mail(mail)
end
def render_properties(properties)
unless properties.nil? || properties.empty?
content = ''

16
app/models/blog.rb Normal file
View File

@ -0,0 +1,16 @@
class Blog < ActiveRecord::Base
# attr_accessible :title, :body
include Redmine::SafeAttributes
belongs_to :user
has_many :articles, :class_name => 'BlogComment', :conditions => "#{BlogComment.table_name}.parent_id IS NULL ", :order => "#{BlogComment.table_name}.created_on DESC"
has_many :blog_comments, :dependent => :destroy, :order => "#{BlogComment.table_name}.created_on DESC"
belongs_to :last_comment, :class_name => 'BlogComment', :foreign_key => :last_comment_id
acts_as_tree :dependent => :nullify
#acts_as_list :scope => '(user_id = #{user_id} AND parent_id #{user_id ? = "#{parent_id}" : "IS NULL"})'
acts_as_watchable
validates :name, presence: true, length: {maximum: 30}
validates :description, length: {maximum: 255}
safe_attributes 'name', 'description'
end

View File

@ -0,0 +1,59 @@
class BlogComment < ActiveRecord::Base
# attr_accessible :title, :body
include Redmine::SafeAttributes
belongs_to :blog
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
acts_as_tree :counter_cache => :comments_count, :order => "#{BlogComment.table_name}.sticky desc ,#{BlogComment.table_name}.created_on ASC"
acts_as_attachable
belongs_to :last_reply, :class_name => 'BlogComment', :foreign_key => 'last_comment_id'
# 虚拟关联
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
acts_as_watchable
validates_presence_of :title, :content
validates_length_of :title, :maximum => 255
#validate :cannot_reply_to_locked_comment, :on => :create
safe_attributes 'title', 'content',"sticky", "locked"
after_save :add_user_activity
before_destroy :destroy_user_activity
scope :like, lambda {|arg|
if arg.blank?
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
where(" LOWER(title) LIKE :p ", :p => pattern)
end
}
#在个人动态里面增加当前动态
def add_user_activity
if self.parent_id.nil? #只有发博文才插入动态
user_activity = UserActivity.where("act_type = '#{self.class.to_s}' and act_id = '#{self.id}'").first
if user_activity
user_activity.save
else
user_activity = UserActivity.new
user_activity.act_id = self.id
user_activity.act_type = self.class.to_s
user_activity.container_type = "Blog"
user_activity.container_id = self.blog_id
user_activity.user_id = self.author_id
user_activity.save
end
end
end
def destroy_user_activity
user_activity = UserActivity.where("act_type = '#{self.class.to_s}' and act_id = '#{self.id}'")
user_activity.destroy_all
end
def deleted_attach_able_by? user
(user && user.logged? && (self.author == user) ) || user.admin?
end
def project
end
end

View File

@ -12,6 +12,7 @@ class HomeworkCommon < ActiveRecord::Base
has_many :homework_tests, :dependent => :destroy
has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
@ -22,7 +23,8 @@ class HomeworkCommon < ActiveRecord::Base
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
after_create :act_as_activity, :send_mail, :act_as_course_activity, :act_as_course_message
after_create :act_as_activity, :send_mail, :act_as_course_message
after_save :act_as_course_activity
after_destroy :delete_kindeditor_assets
def act_as_activity
@ -32,17 +34,27 @@ class HomeworkCommon < ActiveRecord::Base
#课程动态公共表记录
def act_as_course_activity
if self.course
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id)
if self.homework_detail_manual.comment_status == 0
self.course_acts.destroy_all
else
if self.course_acts.size == 0
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id)
end
end
end
end
#课程作业消息记录
def act_as_course_message
if self.course
self.course.members.each do |m|
# if m.user_id != self.user_id
if self.homework_detail_manual.comment_status == 0
self.course_messages.destroy_all
else
self.course.members.each do |m|
# if m.user_id != self.user_id
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
# end
# end
end
end
end
end
@ -53,13 +65,27 @@ class HomeworkCommon < ActiveRecord::Base
end
def send_mail
Mailer.run.homework_added(self)
if self.homework_detail_manual.comment_status != 0
Mailer.run.homework_added(self)
end
end
def is_program_homework?
self.homework_type == 2 && self.homework_detail_programing
end
###添加回复
def self.add_homework_jour(user, notes, id , options = {})
homework = HomeworkCommon.find(id)
if options.count == 0
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
else
jfm = homework.journals_for_messages.build(options)
end
jfm.save
jfm
end
delegate :language_name, :language, :to => :homework_detail_programing
end

View File

@ -1009,6 +1009,16 @@ class Mailer < ActionMailer::Base
end
end
def join_course_request(course, user, role)
@receive = User.find(course.tea_id)
@course = course
@user = user
@role = role
@subject = "#{@user.show_name} #{l(:label_apply_join_course)} #{@course.name} "
mail :to => @receive.mail,
:subject => @subject
end
private
@ -1066,4 +1076,5 @@ class Mailer < ActionMailer::Base
1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
return newpass
end
end

View File

@ -34,6 +34,7 @@ class Member < ActiveRecord::Base
after_destroy :delete_ivite_list
def role
end

View File

@ -35,8 +35,11 @@ class MemberRole < ActiveRecord::Base
!inherited_from.nil?
end
include Trustie::Gitlab::ManageMember
private
def remove_member_if_empty
if member.roles.empty?
member.destroy

4
app/models/org_member.rb Normal file
View File

@ -0,0 +1,4 @@
class OrgMember < ActiveRecord::Base
attr_accessible :organization_id, :role, :user_id
belongs_to :organization
end

View File

@ -1,5 +1,5 @@
class Organization < ActiveRecord::Base
attr_accessible :logo_link, :name
attr_accessible :name, :description, :creator_id, :home_id, :domain, :is_public
has_many :org_members, :dependent => :destroy
has_many :projects
end

View File

@ -770,7 +770,8 @@ class Project < ActiveRecord::Base
'project_type',
'dts_test',
'attachmenttype',
'enterprise_name'
'enterprise_name',
'gpid'
@ -853,6 +854,10 @@ class Project < ActiveRecord::Base
end
end
def owner
User.find(self.user_id)
end
private
def after_parent_changed(parent_was)
@ -1167,5 +1172,7 @@ class Project < ActiveRecord::Base
:forge_act_id => self.id,:forge_act_type => "ProjectCreateInfo")
fa.save!
end
end

View File

@ -57,6 +57,11 @@ class Repository < ActiveRecord::Base
safe_attributes 'url',
:if => lambda {|repository, user| repository.new_record?}
def gitlab?
self.type == 'Repository::Gitlab'
end
def repo_create_validation
unless Setting.enabled_scm.include?(self.class.name.demodulize)
errors.add(:type, :invalid)

View File

@ -0,0 +1,259 @@
#coding=utf-8
require 'redmine/scm/adapters/git_adapter'
class Repository::Gitlab < Repository
attr_protected :root_url
validates_presence_of :url
def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name.to_s
if attr_name == "url"
attr_name = "path_to_repository"
end
super(attr_name, *args)
end
def self.scm_adapter_class
Redmine::Scm::Adapters::GitlabAdapter
end
def self.scm_name
'Gitlab'
end
def commits(authors, start_date, end_date, branch='master')
scm.commits(authors, start_date, end_date,branch).map {|commit|
[commit[:author], commit[:num]]
}
end
def report_last_commit
extra_report_last_commit
end
def extra_report_last_commit
return false if extra_info.nil?
v = extra_info["extra_report_last_commit"]
return false if v.nil?
v.to_s != '0'
end
def supports_directory_revisions?
true
end
def supports_revision_graph?
true
end
def repo_log_encoding
'UTF-8'
end
# Returns the identifier for the given git changeset
def self.changeset_identifier(changeset)
changeset.scmid
end
# Returns the readable identifier for the given git changeset
def self.format_changeset_identifier(changeset)
changeset.revision[0, 8]
end
def branches
scm.branches
end
def tags
scm.tags
end
def default_branch
scm.default_branch
rescue Exception => e
logger.error "git: error during get default branch: #{e.message}"
nil
end
def find_changeset_by_name(name)
if name.present?
changesets.where(:revision => name.to_s).first ||
changesets.where('scmid LIKE ?', "#{name}%").first
end
end
def entries(path=nil, identifier=nil)
entries = scm.entries(path, identifier, :report_last_commit => extra_report_last_commit)
load_entries_changesets(entries)
entries
end
# With SCMs that have a sequential commit numbering,
# such as Subversion and Mercurial,
# Redmine is able to be clever and only fetch changesets
# going forward from the most recent one it knows about.
#
# However, Git does not have a sequential commit numbering.
#
# In order to fetch only new adding revisions,
# Redmine needs to save "heads".
#
# In Git and Mercurial, revisions are not in date order.
# Redmine Mercurial fixed issues.
# * Redmine Takes Too Long On Large Mercurial Repository
# http://www.redmine.org/issues/3449
# * Sorting for changesets might go wrong on Mercurial repos
# http://www.redmine.org/issues/3567
#
# Database revision column is text, so Redmine can not sort by revision.
# Mercurial has revision number, and revision number guarantees revision order.
# Redmine Mercurial model stored revisions ordered by database id to database.
# So, Redmine Mercurial model can use correct ordering revisions.
#
# Redmine Mercurial adapter uses "hg log -r 0:tip --limit 10"
# to get limited revisions from old to new.
# But, Git 1.7.3.4 does not support --reverse with -n or --skip.
#
# The repository can still be fully reloaded by calling #clear_changesets
# before fetching changesets (eg. for offline resync)
def fetch_changesets
scm_brs = branches
return if scm_brs.nil? || scm_brs.empty?
h1 = extra_info || {}
h = h1.dup
repo_heads = scm_brs.map{ |br| br.scmid }
h["heads"] ||= []
prev_db_heads = h["heads"].dup
if prev_db_heads.empty?
prev_db_heads += heads_from_branches_hash
end
return if prev_db_heads.sort == repo_heads.sort
h["db_consistent"] ||= {}
if changesets.count == 0
h["db_consistent"]["ordering"] = 1
merge_extra_info(h)
self.save
elsif ! h["db_consistent"].has_key?("ordering")
h["db_consistent"]["ordering"] = 0
merge_extra_info(h)
self.save
end
save_revisions(prev_db_heads, repo_heads)
end
def save_revisions(prev_db_heads, repo_heads)
h = {}
opts = {}
opts[:reverse] = true
opts[:excludes] = prev_db_heads
opts[:includes] = repo_heads
revisions = scm.revisions('', nil, nil, opts)
return if revisions.blank?
# Make the search for existing revisions in the database in a more sufficient manner
#
# Git branch is the reference to the specific revision.
# Git can *delete* remote branch and *re-push* branch.
#
# $ git push remote :branch
# $ git push remote branch
#
# After deleting branch, revisions remain in repository until "git gc".
# On git 1.7.2.3, default pruning date is 2 weeks.
# So, "git log --not deleted_branch_head_revision" return code is 0.
#
# After re-pushing branch, "git log" returns revisions which are saved in database.
# So, Redmine needs to scan revisions and database every time.
#
# This is replacing the one-after-one queries.
# Find all revisions, that are in the database, and then remove them from the revision array.
# Then later we won't need any conditions for db existence.
# Query for several revisions at once, and remove them from the revisions array, if they are there.
# Do this in chunks, to avoid eventual memory problems (in case of tens of thousands of commits).
# If there are no revisions (because the original code's algorithm filtered them),
# then this part will be stepped over.
# We make queries, just if there is any revision.
limit = 100
offset = 0
revisions_copy = revisions.clone # revisions will change
while offset < revisions_copy.size
recent_changesets_slice = changesets.find(
:all,
:conditions => [
'scmid IN (?)',
revisions_copy.slice(offset, limit).map{|x| x.scmid}
]
)
# Subtract revisions that redmine already knows about
recent_revisions = recent_changesets_slice.map{|c| c.scmid}
revisions.reject!{|r| recent_revisions.include?(r.scmid)}
offset += limit
end
revisions.each do |rev|
transaction do
# There is no search in the db for this revision, because above we ensured,
# that it's not in the db.
save_revision(rev)
end
end
h["heads"] = repo_heads.dup
merge_extra_info(h)
self.save
end
private :save_revisions
def save_revision(rev)
parents = (rev.parents || []).collect{|rp| find_changeset_by_name(rp)}.compact
changeset = Changeset.create(
:repository => self,
:revision => rev.identifier,
:scmid => rev.scmid,
:committer => rev.author,
:committed_on => rev.time,
:comments => rev.message,
:parents => parents
)
unless changeset.new_record?
rev.paths.each { |change| changeset.create_change(change) }
end
changeset
end
private :save_revision
def heads_from_branches_hash
h1 = extra_info || {}
h = h1.dup
h["branches"] ||= {}
h['branches'].map{|br, hs| hs['last_scmid']}
end
def latest_changesets(path,rev,limit=10)
revisions = scm.revisions(path, nil, rev, :limit => limit, :all => false)
return [] if revisions.nil? || revisions.empty?
changesets.find(
:all,
:conditions => [
"scmid IN (?)",
revisions.map!{|c| c.scmid}
]
)
end
def clear_extra_info_of_changesets
return if extra_info.nil?
v = extra_info["extra_report_last_commit"]
write_attribute(:extra_info, nil)
h = {}
h["extra_report_last_commit"] = v
merge_extra_info(h)
self.save
end
private :clear_extra_info_of_changesets
end

View File

@ -77,6 +77,27 @@ class Role < ActiveRecord::Base
self.givable[3..5]
end
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
def to_gitlab_role
case self.position
when 1,2
GUEST
when 5
REPORTER
when 4
DEVELOPER
when 3
MASTER
else
GUEST
end
end
# Copies attributes from another role, arg can be an id or a Role
def copy_from(arg, options={})
return unless arg.present?

View File

@ -93,6 +93,7 @@ class User < Principal
has_many :changesets, :dependent => :nullify
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
has_one :blog, :class_name => 'Blog', :foreign_key => "author_id"
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
belongs_to :auth_source
belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
@ -217,6 +218,8 @@ class User < Principal
# 更新邮箱用户或用户名的同事,同步更新邀请信息
after_update :update_invite_list
include Trustie::Gitlab::ManageUser
scope :in_group, lambda {|group|
group_id = group.is_a?(Group) ? group.id : group.to_i
where("#{User.table_name}.id IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id)
@ -255,6 +258,18 @@ class User < Principal
# count = self.journals_for_messages(:conditions => ["status=? and is_readed = ? " ,1, 0]).count
end
def blog
@blog = Blog.where("author_id = #{self.id}").all[0]
if @blog.nil?
#如果某个user的blog不存在那么就创建一条并且跳转
@blog = Blog.create(:name=>(User.find(self.id).realname.blank? ? User.find(self.id).login : User.find(self.id).realname ),
:description=>'',
:author_id=>self.id)
@blog.save
end
@blog
end
# 查询指派给我的缺陷记录
def count_new_issue_assign_to
self.issue_assigns
@ -345,7 +360,7 @@ class User < Principal
name
end
## end
#added by nie
def count_new_journal_reply
count = self.journal_reply.count
@ -1066,6 +1081,17 @@ class User < Principal
end
private
def sync_gitlab_user
user = self
g = Gitlab.client
u = g.get("/users?search=#{user.mail}").first
unless u
u = g.create_user(user.mail, user.password, name: user.show_name, username: user.login, confirm: "true")
self.gid = u.id
puts "create user #{user.login}"
end
end
end

View File

@ -15,11 +15,11 @@ class CoursesService
page_no = params[:page] || 1
if @school_id == "0" || @school_id.nil?
@courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id")
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id")
else
@courses_all = Course.active.visible.
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
where("#{Course.table_name}.school_id = ?", @school_id)
joins("LEFT JOIN #{CourseStatus.table_name} ON #{Course.table_name}.id = #{CourseStatus.table_name}.course_id").
where("#{Course.table_name}.school_id = ?", @school_id)
end
@course_count = @courses_all.count
@course_pages = Redmine::Pagination::Paginator.new @course_count, per_page_option,page_no
@ -300,26 +300,72 @@ class CoursesService
#@state == 4 您加入的课程不存在
#@state == 5 您还未登录
#@state == 6 申请成功,请等待审核完毕
#@state == 7 您已经发送过申请了,请耐心等待
#@state == 8 您已经是该课程的教师了
#@state == 9 您已经是该课程的教辅了
#@state 其他 未知错误,请稍后再试
def join_course params,current_user
course = Course.find_by_id params[:object_id]
@state = 10
if course
if course_endTime_timeout? course
@state = 2
else
if current_user.member_of_course?(course)
@state = 3
else
if current_user.member_of_course?(course) #如果已经是成员
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
roleName = member.roles[0].name if member
if params[:course_password] == course.password
members = []
members << Member.new(:role_ids => [10], :user_id => current_user.id)
course.members << members
StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id])
@state = 0
#如果加入角色为学生 并且当前是学生
if params[:role] == "10" && roleName == "Student"
@state = 3
#如果加入的角色为老师,并且当前已经是老师
elsif params[:role] == "9" && roleName == "Teacher"
@state = 8
#如果加入的角色教辅并且当前为教辅
elsif params[:role] == "7" && roleName == "TeachingAsistant"
@state = 9
#如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
#如果已经发送过消息了,那么就要给个提示
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
@state = 7
else
Mailer.run.join_course_request(course, User.current, params[:role])
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
@state = 6
end
#如果加入角色是学生,但是是当前课程的教师或者教辅
elsif params[:role] == "10" && roleName != "Student"
member.role_ids = [params[:role]]
member.save
StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id])
@state = 0
end
else
@state = 1
end
else
if params[:course_password] == course.password
if params[:role] == "10" || params[:role] == nil
members = []
members << Member.new(:role_ids => [10], :user_id => current_user.id)
course.members << members
StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id])
@state = 0
else
#如果已经发送过消息了,那么就要给个提示
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0
@state = 7
else
Mailer.run.join_course_request(course, User.current, params[:role])
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
@state = 6
end
end
else
@state = 1
end
end
end
else
@ -336,11 +382,11 @@ class CoursesService
if course.is_public != 0 || current_user.member_of_course?(course)
bids = course.homework_commons.page(params[:page] || 1).per(20).order('created_at DESC')
bids = bids.like(params[:name]) if params[:name].present?
homeworks = []
bids.each do |bid|
homeworks << show_homework_info(course,bid,current_user,is_course_teacher(current_user,course))
end
homeworks
homeworks = []
bids.each do |bid|
homeworks << show_homework_info(course,bid,current_user,is_course_teacher(current_user,course))
end
homeworks
else
raise '403'
end
@ -411,10 +457,10 @@ class CoursesService
#每个作业中学生最后提交的作业
homeworks = []
course.homework_commons.each do |bid|
homework_attach = bid.student_works.order('updated_at DESC').first
unless homework_attach.nil?
homeworks << homework_attach
end
homework_attach = bid.student_works.order('updated_at DESC').first
unless homework_attach.nil?
homeworks << homework_attach
end
end
unless homeworks.count == 0
homeworks.sort!{|order,newer| newer.updated_at <=> order.updated_at}
@ -433,21 +479,21 @@ class CoursesService
result
end
# 课程课件
def course_attachments params
result = []
course = Course.find(params[:course_id])
attachments = course.attachments.order("created_on ")
if !params[:name].nil? && params[:name] != ""
attachments.each do |atta|
result << atta if atta.filename.include?(params[:name])
# 课程课件
def course_attachments params
result = []
course = Course.find(params[:course_id])
attachments = course.attachments.order("created_on ")
if !params[:name].nil? && params[:name] != ""
attachments.each do |atta|
result << atta if atta.filename.include?(params[:name])
end
else
result = attachments
end
result
end
end
else
result = attachments
end
result
end
# 课程学生列表
def course_members params
@ -488,20 +534,20 @@ class CoursesService
end
def del_assitant_teacher params
member = Member.where("user_id = ? and course_id = ?",params[:user_id],params[:course_id])
member.each do |m|
m.destroy
end
user_admin = CourseInfos.where("user_id = ? and course_id = ?",params[:user_id], params[:course_id])
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id])
joined.each do |join|
join.delete
end
member = Member.where("user_id = ? and course_id = ?",params[:user_id],params[:course_id])
member.each do |m|
m.destroy
end
user_admin = CourseInfos.where("user_id = ? and course_id = ?",params[:user_id], params[:course_id])
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id])
joined.each do |join|
join.delete
end
end
def create_course_notice params ,current_user
@ -570,11 +616,11 @@ class CoursesService
:open_anonymous_evaluation => open_anonymous_evaluation,
#:homework_for_anonymous_comments => homework_for_anonymous_comments,
:created_on => bid.created_at,:deadline => bid.end_time,
:homework_notsubmit_num => bid.course.members.count - bid.student_works.count,
:homework_submit_num => bid.student_works.count,
:homework_status_student => get_homework_status( bid),:homework_status_teacher => homework_status_desc( bid),
:student_evaluation_part => get_evaluation_part( bid ,3),
:ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?}
:homework_notsubmit_num => bid.course.members.count - bid.student_works.count,
:homework_submit_num => bid.student_works.count,
:homework_status_student => get_homework_status( bid),:homework_status_teacher => homework_status_desc( bid),
:student_evaluation_part => get_evaluation_part( bid ,3),
:ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?}
end
@ -586,9 +632,9 @@ class CoursesService
homework_count = bid.homeworks.count #已提交的作业数量
student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
description = bid.description
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
state = bid.comment_status
#end
#end
open_anonymous_evaluation = bid.open_anonymous_evaluation
{:course_name => course.name,:id => bid.id, :course_teacher => author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
@ -685,12 +731,12 @@ class CoursesService
latest_course_dynamics << {:time => latest_news.first.created_on }
end
# 课程讨论区
latest_message = course.boards.first.topics.page(1).per(2)
unless latest_message.first.nil?
topic_count = course.boards.nil? ? 0 : course.boards.first.topics.count
topics = latest_message.all
latest_course_dynamics << {:time => latest_message.first.created_on}
end
latest_message = course.boards.first.topics.page(1).per(2)
unless latest_message.first.nil?
topic_count = course.boards.nil? ? 0 : course.boards.first.topics.count
topics = latest_message.all
latest_course_dynamics << {:time => latest_message.first.created_on}
end
# 课程资源
# latest_attachment = course.attachments.order("created_on desc").page(1).per(2)
# unless latest_attachment.first.nil?
@ -727,29 +773,29 @@ class CoursesService
unless active_students.empty?
latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"}
end
latest_course_dynamic = latest_course_dynamics.first
unless latest_course_dynamic.nil?
result << {:course_name => course.name,
:current_user_is_member => current_user.member_of_course?(course),
:current_user_is_teacher => is_course_teacher(current_user,course),
:course_id => course.id,
:course_img_url => url_to_avatar(course),
:course_time => course.time,
:course_term => course.term,
:news_count => notices_count,
:homework_count => homework_count,
:topic_count => topic_count,
:news => notices,
:homeworks => homeworkss,
:topics => topics,
:better_students => better_students,
:active_students => active_students,
:message => "",
:course_student_num=>course ? course.members.count : 0,
#:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前",
:time_from_now=>time_from_now(latest_course_dynamic[:time].to_time), #.strftime('%Y-%m-%d %H:%M:%S').to_s,
:time=>latest_course_dynamic[:time].to_time}
end
latest_course_dynamic = latest_course_dynamics.first
unless latest_course_dynamic.nil?
result << {:course_name => course.name,
:current_user_is_member => current_user.member_of_course?(course),
:current_user_is_teacher => is_course_teacher(current_user,course),
:course_id => course.id,
:course_img_url => url_to_avatar(course),
:course_time => course.time,
:course_term => course.term,
:news_count => notices_count,
:homework_count => homework_count,
:topic_count => topic_count,
:news => notices,
:homeworks => homeworkss,
:topics => topics,
:better_students => better_students,
:active_students => active_students,
:message => "",
:course_student_num=>course ? course.members.count : 0,
#:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前",
:time_from_now=>time_from_now(latest_course_dynamic[:time].to_time), #.strftime('%Y-%m-%d %H:%M:%S').to_s,
:time=>latest_course_dynamic[:time].to_time}
end
end
#返回数组集合
@ -768,9 +814,9 @@ class CoursesService
sql = "select users.*,ROUND(sum(student_works.final_score),2) score from student_works left outer join users on student_works.user_id = users.id" <<
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score desc limit #{page*10},10"
sql_count = " select count(distinct(student_works.user_id) ) " <<
" from student_works left outer join users on student_works.user_id = users.id " <<
" where homework_common_id in " <<
" ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) "
" from student_works left outer join users on student_works.user_id = users.id " <<
" where homework_common_id in " <<
" ( select id from homework_commons where homework_commons.course_id = #{params[:course_id]}) "
max_size = ActiveRecord::Base.connection().select_value(sql_count)
user_list = User.find_by_sql(sql)
else

View File

@ -0,0 +1,41 @@
<div class="mt10 fl" style="width: 600px">
<% for attachment in attachments %>
<!--<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">-->
<!--<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">-->
<!--<span title="<%#= attachment.filename%>" id = "attachment_">-->
<% if options[:length] %>
<span class="pic_files fl "></span>
<%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true,:length => options[:length] -%>
<a class="fl FilesName02"> (<%= number_to_human_size attachment.filesize , :precision => 0 %>)</a>
<% if options[:deletable] %>
<%#= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => 'delete',
#:remote => true,
#:id => "attachments_" + attachment.id.to_s,
:title => l(:button_delete) %>
<span class="pic_del fl "> <a href="<%=attachment_path(attachment) %>" onclick="confirm(<%=l(:text_are_you_sure) %>)" data-method="delete"> </a></span>
<% end %>
<div class="cl"></div>
<% else %>
<span class="pic_files fl "></span>
<%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true, :length => 45 -%>
<a href="javascript:void(0);" class="fl FilesName02"> (<%= number_to_human_size attachment.filesize , :precision => 0 %>)</a>
<% if options[:deletable] %>
<a href="<%=attachment_path(attachment) %>" onclick="confirm(<%=l(:text_are_you_sure) %>)" data-method="delete"> <span class="pic_del fl "></span> </a>
<% end %>
<div class="cl"></div>
<% end %>
<% end %>
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<div class="pro_pic mb10" width="100" height="73">
<% images.each do |attachment| %>
<div><%= thumbnail_tag(attachment) %></div>
<% end %>
</div>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1,78 @@
<style type="text/css">
input.is_public,input.is_public_checkbox{height:12px;}
input.is_public_checkbox{margin-left:4px;margin-right:4px;}
</style>
<div class="fl">
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><span class="ispublic-label"><%= l(:field_is_public) %>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
<%= if attachment.id.nil?
#待补充代码
else
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
end
%>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<div class="cl"></div>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public) %>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
<%= if attachment.id.nil?
#待补充代码
else
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
end
%>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<div class="cl"></div>
<% end %>
<% end %>
</span>
<div class="cl"></div>
<span class="add_attachment" style="font-weight:normal;">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
<a href="javascript:void(0);" onclick="_file.click();" class="AnnexBtn fl mr15">上传附件</a>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => ie8? ? '' : 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js', :project => container),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<span id="upload_file_count">
<%= l(:label_no_file_uploaded) %>
</span>
(<%= l(:label_max_size) %>:
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>

View File

@ -0,0 +1,53 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'blog' %>
<div class="resources mt10">
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" value="<%= article.title%>" name="blog_comment[title]" id="message_subject" class="InputBox w713" style="width: 720px !important;" maxlength="255" onkeyup="regexTopicSubject();" placeholder="发布文章,请先输入文章标题" " />
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: block;">
<%if User.current.id == user.id%>
<div class="mt10">
<%= f.check_box :sticky%>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked%>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<div class="cl"></div>
</div>
<% end %>
<div class="mt10">
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :content,:editor_id => 'message_content_editor',
:owner_id => article.nil? ? 0: article.id,
:owner_type => OwnerTypeHelper::BLOGCOMMENT,
:width => '100%',
:height => 300,
:minHeight=>300,
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
<div class="cl"></div>
<p id="message_content_span"></p>
</div>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'blog_comments/blog_attachments', :locals => {:container => article} %>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_article();">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="<%= user_blog_blog_comment_path(:user_id=>article.author.id,:blog_id=>article.blog_id,:id=>article.id)%>" class="fr mr10 mt3" >取消</a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,62 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'blog' %>
<div class="resources mt10">
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="blog_comment[title]" id="message_subject" class="InputBox w713" style="width: 720px !important;" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布文章,请先输入文章标题" " >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">
<%if User.current.id == user.id%>
<div class="mt10">
<%= f.check_box :sticky%>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked%>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<div class="cl"></div>
</div>
<% end %>
<div class="mt10">
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
:owner_id => article.nil? ? 0: article.id,
:owner_type => OwnerTypeHelper::BLOGCOMMENT,
:width => '100%',
:height => 300,
:minHeight=>300,
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
<div class="cl"></div>
<p id="message_content_span"></p>
</div>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'blog_comments/blog_attachments', :locals => {:container => article} %>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_article();">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_article();">取消</a>
</div>
<div class="cl"></div>
</div>
</div>
<%#= render :partial => 'course_new_topic', :locals => {:f => f, :topic => @message} %>
<!--<li>
<div class="ml55 fl" nhname="toolbar_container"></div>
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%#= l(:button_cancel) %></a>
<a href="javascript:void(0);" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px">
<%#= l(:button_submit)%>
</a>
<div class="cl"></div>
</li>-->
</div>
</div>

View File

@ -0,0 +1,35 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<li>
<div style="display: none ;" class="fl"><label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label></div>
<div style="display: none;"><%= f.text_field :title, { size: 60, id: "message_subject",:class=>"talk_input w585 fl" }.merge({ hidden: "hidden"}) %></div>
<div class="cl"></div>
</li>
<li class="ml60 mb5">
<div class="cl"></div>
</li>
<li>
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<!--<label class="fl" >
<span class="c_red">*</span>&nbsp;
<%#= l(:field_description) %>&nbsp;&nbsp;
</label>-->
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<input type="hidden" name="blog_comment[title]" value="RE:<%= article.title%>">
<input type="hidden" name="blog_comment[sticky]" value="0">
<input type="hidden" name="blog_comment[locked]" value="0">
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
:width => '99%',
:height => 100,
:minHeight=>100,
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
<div class="cl"></div>
<p id="message_content_span"></p>
</li>
<div class="cl"></div>
<li >
<div class="cl"></div>
</li>

View File

@ -0,0 +1,34 @@
<style type="text/css">
/*回复框*/
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-outline{border:none;}
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
.ReplyToMessageInputContainer .ke-container{float:left;}
</style>
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10">
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
<input type="hidden" name="quote[quote]" id="quote_quote">
<% if course_id%>
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
<% end %>
<input type="hidden" name="blog_comment[title]" id="reply_subject">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
<div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,6 @@
<% if User.current.logged? && User.current.id == @user.id %>
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id},:method=>'PUT',
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %>
<% end %>
<% end %>

View File

@ -0,0 +1,10 @@
if($("#reply_message_<%= @blogComment.id%>").length > 0) {
$("#reply_message_<%= @blogComment.id%>").replaceWith("<%= escape_javascript(render :partial => 'blog_comments/simple_ke_reply_form', :locals => {:reply => @blogComment,:temp =>@temp,:subject =>@subject,:course_id=>@course_id}) %>");
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%");
});
}else if($("#reply_to_message_<%= @blogComment.id%>").length >0) {
$("#reply_to_message_<%= @blogComment.id%>").replaceWith("<p id='reply_message_<%= @blogComment.id%>'></p>");
}

View File

@ -0,0 +1,7 @@
<% if @in_user_center%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% end %>

View File

@ -0,0 +1,175 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<script>
function expand_reply(container,btnid){
var target = $(container).children();
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() {
init_activity_KindEditor_data(<%= @article.id%>,null,"85%");
showNormalImage('message_description_<%= @article.id %>');
});
</script>
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @article.id%>').show();" onmouseout="$('#message_setting_<%= @article.id%>').hide();">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
</div>
<div class="postThemeWrap">
<% if @article.author.id == User.current.id%>
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @article.id},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
</li>
<li>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @article.id},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
</li>
</ul>
</li>
</ul>
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @article.title%></a>
</div>
<div class="cl"></div>
<div class="postDetailCreater">
<% if @article.try(:author).try(:realname) == ' ' %>
<%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
</div>
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
<div class="memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @article.content.html_safe%>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%#= link_to_attachments_course @topic, :author => false %>
<% if @article.attachments.any?%>
<% options = {:author => true, :deletable => false} %>
<%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %>
<% end %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% count=0 %>
<% if @article.parent %>
<% count=@article.parent.children.count%>
<% else %>
<% count=@article.children.count%>
<% end %>
<div class="homepagePostReply">
<% unless count == 0 %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=count %></div>
<div class="homepagePostReplyBannerTime"></div>
<!-- <div class="homepagePostReplyBannerMore">
<%# if @reply_count > 2%>
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
<%# end %>
</div>-->
</div>
<div class="" id="reply_div_<%= @article.id %>">
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% 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 %>
</div>
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
l(:button_reply),
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id},
:remote => true,
:method => 'get',
:class => 'fr newsBlue',
:title => l(:button_reply)) if !@article.locked? && User.current.logged? %>
<%= link_to(
l(:button_delete),
{:controller => 'blog_comments',:action => 'destroy', :id => reply.id},
:method => :delete,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.author.id == User.current.id %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if !@article.locked? && User.current.logged?%>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @article.id %>">
<%= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'canel_message_replay();', :class => " grey_btn fr c_white mt10 mr5" %>
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-right: 5px;" %>
<% end %>
<div class="cl"></div>
</div>
</div>
<% end %>
</div>
</div>

View File

@ -0,0 +1,172 @@
<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%>
<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 && 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 && User.current.id == activity.author.id %>
</li>
</ul>
</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"%>
</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">
发帖时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostIntro break_word upload_img list_style" id="activity_description_<%= user_activity_id%>">
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>
<%= activity.parent.content.to_s.html_safe%>
<% end %>
</div>
<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="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="topBorder" style="display: <%= count<=0 && !activity.locked ? '': 'none' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
<%= count %>
)</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) %>
</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%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" 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>
<div class="cl"></div>
</div>
<% end %>
</div>
</div>

View File

@ -0,0 +1,101 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %>
<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>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
function reset_article(){
$("#message_subject").val("");
$("#subjectmsg").text("");
document.getElementById("blog_comment_sticky").checked=false;
document.getElementById("blog_comment_locked").checked=false;
$("#topic_attachments").html("<%= escape_javascript(render :partial => 'blog_comments/blog_attachments', :locals => {:container => BlogComment.new})%>");
message_content_editor.html("");
$("#topic_editor").slideToggle();
}
<%# if @is_new%>
// $(function(){
// $("#message_subject").focus();
// });
<%#end%>
</script>
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
<%= @user.name%>的博客
</div>
</div>
<% if User.current.logged? && User.current.id == @user.id %>
<%= labelled_form_for @article, :url =>{:controller=>'blog_comments',:action => 'create',:user_id=>user.id , :blog_id => blog.id},
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'blog_comments/new', :locals => {:f => f, :article => @article, :edit_mode => false, :user => @user} %>
<% end %>
<% 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 () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
});
</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 %>
<% end%>
</div>
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();
});
</script>

View File

@ -0,0 +1,187 @@
<style type="text/css">
div.talk_new .ke-container{margin-left:2px;}
.break_word {width:100%;}
</style>
<script type="text/javascript">
//头部导航
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var div = document.getElementById(menuids[i]);
if(div == undefined)continue;
var ultags=div.getElementsByTagName("ul");
for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle";
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.display="block";
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none";
}
}
}
}
if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)
</script>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_on desc"), :page => 0, :user => @user} %>
<script type="text/javascript">//侧导航
function nh_check_field(params){
var result=true;
if(params.subject!=undefined){
if($.trim(params.subject.val()) == ""){
params.subjectmsg.html('主题不能为空');
params.subjectmsg.css({color:'#ff0000'});
result=false;
}else{
params.subjectmsg.html('填写正确');
params.subjectmsg.css({color:'#008000'});
}
params.subjectmsg.show();
}
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync(); //用上面那句ie11提交到服务器居然木有值
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function nh_init_board(params){
//发帖/编辑/回复按钮的click
params.showbtn.click(function(){
params.textarea.removeAttr('placeholder');
if(params.textarea.data('init') == undefined){
//初始化编辑器
var editor = params.kindutil.create(params.textarea, {
// allowPreviewEmoticons : false,
// allowImageUpload : false,
autoHeightMode : true,
resizeType : 1,minWidth:"1px",width:"560px",height:"150px",
allowFileManager:true,uploadJson:"/kindeditor/upload",
fileManagerJson:"/kindeditor/filemanager",
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
// var edit = this.edit;
// var body = edit.doc.body;
// edit.iframe.height(minHeight);
// this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 30, minHeight));
},
afterCreate:function(){
this.loadPlugin("autoheight");
var userAgent = navigator.userAgent.toLowerCase();
if(/trident/.test(userAgent)){
$("div.talk_new .ke-container").css({'margin-left':'0px'});
}
// var toolbar = $("div[class='ke-toolbar']",params.about_talk);
// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
// params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
//主题输入框按键事件
params.inputsubject.keyup(function(){
nh_check_field({subject:params.inputsubject,subjectmsg:params.subjectmsg});
})
//表单提交
params.form.submit(function(){
var is_checked = nh_check_field({
issubmit:true,
subject:params.inputsubject,
subjectmsg:params.subjectmsg,
content:editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
//return true 居然不提交 fuck your sister
$(this)[0].submit();
// return true;
}
return false;
});
//提交按钮click
params.submitbtn.click(function(){
params.form.submit();
});
//取消按钮click
params.cancelbtn.click(function(){
params.about_talk.toggle();//显示/隐藏编辑区
if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
params.form[0].reset();
if(params.type=='reply'){
params.textarea.empty();
}else{
params.textarea.html(params.init_content_val.val());
}
var str = params.textarea.html();
str=str.replace(new RegExp(/&lt;/g),'<');
str=str.replace(new RegExp(/&gt;/g),'>');
editor.html(str);
params.subjectmsg.hide();
params.contentmsg.hide();
if(params.quote_show!=undefined)params.quote_show.empty();
if(params.quote_input!=undefined)params.quote_input.empty();
}else{
if(params.type=='reply'){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
//params.jumphref.attr('href','#'+params.form.attr('id'));
//params.jumphref[0].click();
}else{
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// params.inputsubject.focus();
}
}
});
params.textarea.data('init','1');//标记为已经初始化
}
params.cancelbtn.click();//显示/隐藏编辑区
});
if(params.type == 'reply'){
params.showbtn_child.click(function(){
if(params.textarea.data('init') == undefined){
params.showbtn.click();
}else{
params.cancelbtn.click();
if(params.about_talk.is(':hidden')){
params.cancelbtn.click();
}
}
var parent_topic_id = $(this).data('topic-id');
if(parent_topic_id!=undefined)$("input[name='parent_topic']",params.form).val(parent_topic_id);
var ref_str = params.get_ref_str_call($(this));
params.quote_show.html(ref_str);
params.quote_input.html(ref_str);
});
}
}
</script>

View File

View File

@ -8,7 +8,7 @@
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
</th>
<td class="line-code">
<pre style="width:880px;word-wrap: break-word; word-break: normal; "><%= line.html_safe %></pre>
<pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre>
</td>
</tr>
<% line_num += 1 %>

View File

@ -68,13 +68,24 @@
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
init_activity_KindEditor_data(<%= activity.id%>, null, "87%");
showNormalImage('activity_description_<%= activity.id %>');
if($("#intro_content_<%= activity.id %>").height() > 360) {
$("#intro_content_show_<%= activity.id %>").show();
}
$("#intro_content_show_<%= activity.id %>").click(function(){
$("#activity_description_<%= activity.id %>").toggleClass("maxh360");
$("#activity_description_<%= activity.id%>").toggleClass("lh18");
$("#intro_content_show_<%= activity.id %>").hide();
$("#intro_content_hide_<%= activity.id %>").show();
});
$("#intro_content_hide_<%= activity.id %>").click(function(){
$("#activity_description_<%= activity.id %>").toggleClass("maxh360");
$("#activity_description_<%= activity.id%>").toggleClass("lh18");
$("#intro_content_hide_<%= activity.id %>").hide();
$("#intro_content_show_<%= activity.id %>").show();
});
});
</script>
<% if activity && activity.course_act%>

View File

@ -0,0 +1,32 @@
<div class="f16 fontBlue fb fl">请选择课程大纲</div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>-->
<div class="fl">
<div class="blogSearchBox">
<input type="text" name="course_outline_search" id="course_outline_search" placeholder="请输入大纲名称搜索" class="blogSearchContent" />
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
<!--<input class="searchIconPopup" name="commit" onfocus="this.blur();" style="border-style:none" type="submit" value="">-->
</div>
</div>
<span class="f12 c_red fl mb8" id="course_outline_hint" style="display: none">未搜索到对应大纲,请重新输入</span>
<%= form_tag(url_for(:controller=>'courses',:action=>'set_course_outline',:id=>course.id),:method=>'post',:remote=>'true') do %>
<input name="is_in_show_outline_page" value="<%= show_page %>" type="hidden" />
<div class="blogBlock fl" id="course_outline_list" >
<% unless articles.blank? %>
<% articles.each do |article|%>
<ul class="blogRow">
<li class="fl">
<input name="outline_id" type="radio" value="<%= article.id%>" class="courseSendCheckbox"/>
</li>
<li class="blogTitle fl"><%= article.title%></li>
</ul>
<div class="homeworkPublishTime">发布时间:<%= format_date(article.created_at)%></div>
<% end %>
<% end %>
</div>
<div>
<div class="courseSendSubmit"><a href="javascript:void(0);" class="sendSourceText" onclick="if($('input[name=outline_id]:radio:checked').length != 0 ) { $(this).parent().parent().submit(); }else{ return false;}">确定</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>

View File

@ -4,33 +4,33 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>快速进入课程通道</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
div,img,tr,td{ border:0;}
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{}
#popbox{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
#popbox div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
#popbox div,img,tr,td{ border:0;}
#popbox table,tr,td{border:0; cellspacing:0; cellpadding:0;}
#popbox ul,li{ list-style-type:none}
#popbox .cl{ clear:both; overflow:hidden; }
#popbox a{ text-decoration:none; }
#popbox a:hover{}
.alert_box {width:488px;height:550px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; }
#popbox{width:488px;height:368px;}
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
.C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
.C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
.C_top p{ color:#a9aaaa; line-height:22px;}
.C_form{ margin:20px 0 0 60px;}
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
.C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:97px;}
.width190{ width:190px; height:26px; border-color:#e1e1e1;}
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
.C_form a:hover{ text-decoration:underline;}
.C_form a.btn_join{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#269ac9; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
.C_form a.btn_join:hover{ background:#297fb8; text-decoration: none;}
.C_form a.btn_cancel{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#c1c1c1; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
.C_form a.btn_cancel:hover{ background:#717171; text-decoration: none;}
.IDType {border:1px solid #e1e1e1; outline: none; width: 65px; height: 25px;}
#popbox .C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
#popbox .C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
#popbox .C_top p{ color:#a9aaaa; line-height:22px;}
#popbox .C_form{ margin:20px 0 0 60px;}
#popbox .C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
#popbox .C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
#popbox .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:97px;}
#popbox .width190{ width:190px; height:26px; border-color:#e1e1e1;}
#popbox .C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
#popbox .C_form a:hover{ text-decoration:underline;}
#popbox .C_form a.btn_join{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#269ac9; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
#popbox .C_form a.btn_join:hover{ background:#297fb8; text-decoration: none;}
#popbox .C_form a.btn_cancel{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#c1c1c1; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
#popbox .C_form a.btn_cancel:hover{ background:#717171; text-decoration: none;}
#popbox .IDType {border:1px solid #e1e1e1; outline: none; width: 65px; height: 25px;}
</style>
<script type="text/javascript">
function submit_form(obj)
@ -62,13 +62,13 @@
<li>
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<span class="tips" style="width: 72px; display: inline-block;">课&nbsp;程&nbsp;ID</span>
<span class="tips" style="width: 68px; display: inline-block;">课&nbsp;程&nbsp;ID</span>
<input class=" width190" name="object_id" id="object_id" type="text" value="" >
<input type="text" style="display: none"/>
</li>
<li class="mB5">课程ID是所在课程网址中显示的序号</li>
<li>
<span class="tips">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</span>
<span class="tips" style="width: 68px; display: inline-block;">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</span>
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
</li>
<li style="margin-top: 30px;">

View File

@ -23,4 +23,6 @@
<% else %>
alert("未知错误,请稍后再试");
<% end %>
<% else %>
location.reload();
<% end %>

View File

@ -0,0 +1,9 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list',:locals => {:articles=>@blog_articles,:course=>@course,:show_page=>@is_in_show_outline_page}) %>');
showModal('ajax-modal', '300px');
//$('#ajax-modal').css('height','250px');
$('#ajax-modal').css('padding-top','0px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before(' <a href="javascript:void(0);" onclick="hideModal()" class="resourceClose" style="margin-left: 285px"></a>');
$('#ajax-modal').parent().css("top","30%").css("left","50%");
$('#ajax-modal').parent().addClass("courseOutlinePopup");
$('#ajax-modal').css("padding-left","16px")//.css("padding-bottom","16px");

View File

@ -1,25 +1,37 @@
<% if @object_id && @state != 6%>
<% if @object_id && @state != 6 && @state !=4 %>
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>");
<% end %>
<% if @state %>
<% if @state == 0 %>
alert("加入成功");
hideModal($("#popbox02"));
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
hideModal();
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 4 %>
alert("您加入的课程不存在");
<% elsif @state == 5 %>
alert("您还未登录");
<% elsif @state == 6 %>
alert("申请成功,请等待审核")
alert("申请成功,请等待审核");
hidden_join_course_form();
<% elsif @state == 7%>
alert("您已经发送过申请了,请耐心等待");
hidden_join_course_form();
<% elsif @state == 8%>
alert("您已经是该课程的教师了");
hidden_join_course_form();
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 9%>
alert("您已经是该课程的教辅了");
hidden_join_course_form();
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% else %>
alert("未知错误,请稍后再试");
<% end %>

View File

@ -1,3 +1,4 @@
$('#topnav_course_menu').hide();
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
showModal('ajax-modal', '540px');
$('#ajax-modal').css('height','390px');

View File

@ -0,0 +1,8 @@
hideModal();
<%if @course.tea_id == User.current.id && @course.outline == 0 %>
<% else %>
$("#course_outline_bar").html('<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>')
<%end %>
<%if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%>
window.location.href='<%=syllabus_course_path(@course) %>';
<% end %>

View File

@ -0,0 +1,212 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
<style type="text/css">
/*回复框*/
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;}
div.ke-container{float:left;}
</style>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<script>
function expand_reply(container,btnid){
var target = $(container).children();
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() {
init_activity_KindEditor_data(<%= @article.id%>,null,"87%");
showNormalImage('message_description_<%= @article.id %>');
});
</script>
<div class="postRightContainer ml10" >
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
</div>
<div class="postThemeWrap">
<% if User.current && @article.author.id == User.current.id%>
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" >
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<a class="postOptionLink " onclick="course_outline('<%= @course.id%>','Y')" >重设大纲</a>
</li>
<li>
<%= link_to(
'取消大纲',
{:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id},
:method => :delete,
:data => {:confirm => '确定取消么'},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
</li>
</ul>
</li>
</ul>
</div>
<!--<div class="homepagePostSetting" id="message_setting_<%#= @article.id%>" >-->
<!--<ul>-->
<!--<li class="syllabusSettingIcon" >-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--<a class="syllabusSettingIcon fr" style="width: 100px" onclick="course_outline('<%= @course.id%>')" ><span class="f14 fontGrey2" style="padding-left: 20px">[设置大纲]</span>-->
<!--</a>-->
<%end%>
<div class="postDetailTitle fl" style="width: 550px !important;">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @article.title%></a>
</div>
<div class="cl"></div>
<div class="postDetailCreater">
<% if @article.try(:author).try(:realname) == ' ' %>
<%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
</div>
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
<div class="memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @article.content.html_safe%>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%#= link_to_attachments_course @topic, :author => false %>
<% if @article.attachments.any?%>
<% options = {:author => true, :deletable => false} %>
<%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %>
<% end %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% count=0 %>
<% if @article.parent %>
<% count=@article.parent.children.count%>
<% else %>
<% count=@article.children.count%>
<% end %>
<div class="homepagePostReply">
<% unless count == 0 %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=count %></div>
<div class="homepagePostReplyBannerTime"></div>
<!-- <div class="homepagePostReplyBannerMore">
<%# if @reply_count > 2%>
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
<%# end %>
</div>-->
</div>
<div class="" id="reply_div_<%= @article.id %>">
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% 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 %>
</div>
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
l(:button_reply),
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
:remote => true,
:method => 'get',
:class => 'fr newsBlue',
:title => l(:button_reply)) if !@article.locked? && User.current.logged? %>
<%= link_to(
l(:button_delete),
{:controller => 'blog_comments',:action => 'destroy',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
:method => :delete,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.author.id == User.current.id %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if !@article.locked? && User.current.logged?%>
<!--<div class="talkWrapMsg" nhname="about_talk_reply">-->
<!--<em class="talkWrapArrow"></em>-->
<!--<div class="cl"></div>-->
<!--<div class="talkConIpt ml5 mb10" id="reply<%#= @article.id %>">-->
<!--<%#= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>-->
<!--<input type="hidden" name="course_id" value="<%#= @course.id%>">-->
<!--<%#= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %>-->
<!--<%#= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'canel_message_replay();', :class => " grey_btn fr c_white mt10 mr5" %>-->
<!--<%#= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-right: 5px;" %>-->
<!--<%# end %>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<!--</div>-->
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @article.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer" style="margin-top: 8px">
<div nhname='new_message_<%= @article.id%>' style="display:none;">
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
<input type="hidden" name="course_id" value="<%= @course.id%>"
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
<input type="hidden" name="blog_comment[sticky]" value="0">
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="blog_comment[locked]" value="0">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
<div nhname='toolbar_container_<%= @article.id%>' style="float:left; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= @article.id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
</div>

View File

@ -7,7 +7,7 @@
<span class="f14 fontGrey3 fl mt5">开启匿评</span>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_start%>"/>
<%= calendar_for('evaluation_start_time')%>
<%#= calendar_for('evaluation_start_time')%>
</div>
<div class="cl"></div>
<p id="homework_evaluation_start_time" class="c_red"></p>
@ -18,7 +18,7 @@
<span class="f14 fontGrey3 fl mt5">关闭匿评</span>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_end" id="evaluation_end_time" placeholder="关闭匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_end%>"/>
<%= calendar_for('evaluation_end_time')%>
<%#= calendar_for('evaluation_end_time')%>
</div>
<div class="cl"></div>
<p id="homework_evaluation_end_time" class="c_red"></p>

View File

@ -1,6 +1,7 @@
<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_publish_time").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");

View File

@ -1,6 +1,7 @@
<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_publish_time").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>");

View File

@ -0,0 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:remote=>true}) %>');
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed");

View File

@ -1,6 +1,10 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att') %>');
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed");
$(function() { $('#evaluation_start_time').datepicker(datepickerOptions);
$('#evaluation_end_time').datepicker(datepickerOptions);
});

View File

@ -22,8 +22,11 @@
<% end %>
</div>
<div class="mt5">
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">
<%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a>
<!--<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">-->
<%#= l(:label_technical_support) %>
<!--白&nbsp;&nbsp;&nbsp;羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad-->
<a href="javascript:void(0);" style="color: #269ac9;">
<p style="text-align: center"> 请加入师姐答疑群</p> <p style="text-align: center">173184401</p> </a>
</div>
</div>
<div class="side_bottom"></div>

View File

@ -54,16 +54,51 @@
</div>
<div class="cl"></div>
<!--<div >-->
<!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">-->
<!--<%#= @course.name %>-->
<!--</a>-->
<!--<%# if @course.is_public == 0%>-->
<!--<span class="img_private ">-->
<!--<%#= l(:field_is_private)%>-->
<!--</span>-->
<!--<%# end %>-->
<!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# else%>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# end %>-->
<!--</div>-->
<div >
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<% if @course.is_public == 0%>
<span class="img_private ">
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<div>
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<% if @course.is_public == 0%>
<!--<span class="img_private "></span>-->
<span class="img_private mr5 fl">
<%= l(:field_is_private)%>
</span>
<% end %>
</div>
<% end %>
<span id="course_outline_bar">
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<%else%>
<%end %>
</span>
</div>
</div>
<div class="cl"></div>
<div class="pr_info_foot ">
<%= l(:label_account_identity_teacher)%><%= course_teacher_link teacher_num %>
@ -166,5 +201,51 @@
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
<script>
var blog_artile_list_html = '';
$(function(){
$(document).on('input','input[name="course_outline_search"]',function(e){
throttle(course_outline_search,window,e);
})
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
function course_outline_search(e){
// if($(e.target).val().trim() == ''){
// return;
// }
$("#course_outline_hint").hide();
$.ajax({
url:'<%=search_course_outline_course_path(@course) %>'+"?&title="+ e.target.value,
type:'post',
success:function(data){
if(data.length != 0 ){
$("#course_outline_list").html('');
for(var i =0;i<data.length;i++){
var html = ' <ul class="blogRow"> '+
' <li class="fl"> '+
'<input name="outline_id" type="radio" value="'+data[i].blog_comment.id+'" class="courseSendCheckbox"/>'+
'</li>'+
'<li class="blogTitle fl">'+data[i].blog_comment.title+'</li>'+
'</ul>'+
'<div class="homeworkPublishTime">发布时间:'+data[i].blog_comment.created_at.match(/(\S*)T/)[1]+'</div>';
$("#course_outline_list").append(html)
}
}else{
$("#course_outline_list").html('');
$("#course_outline_hint").show();
}
}
})
}
})
</script>
</html>

View File

@ -0,0 +1,157 @@
<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<%#@nav_dispaly_project_label = 1 %>
<!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 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body onload="prettyPrint();">
<div class="navContainer mb10">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else %>
<%= render :partial => 'layouts/unlogin_header' %>
<% end %>
</div>
<div class="cl"></div>
<% @organization = Organization.find(params[:id])%>
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="homepageLeft">
<div class="homepagePortraitContainer">
<div class="pr_info_logo fl mr10 mb5">
<%= image_tag(url_to_avatar(@organization), :width=>"60", :height=>"60", :alt=>"组织logo") %>
</div>
<div class="orgName fl mb5 f14">组织id:<%= @organization.id %></div>
<a href="/projects/813/settings" class="pr_join_a"><span class="pr_setting"></span>配置</a>
<div class="cl"></div>
<div class="f12 fontGrey3">文章&nbsp;(&nbsp;<a href="javascript:void(0);" class="linkBlue">3</a>&nbsp;)&nbsp;|&nbsp;成员&nbsp;(&nbsp;<a href="javascript:void(0);" class="linkBlue">10</a>&nbsp;)</div>
</div>
<div class="homepageLeftMenuContainer">
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText">动态</a></div>
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText">项目</a><a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a></div>
<div class="homepageLeftMenuCourses borderBottomNone">
<ul style="display:none;">
<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称一</a></li>
<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称二</a></li>
<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称三</a></li>
<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称四</a></li>
<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey">项目名称五</a></li>
<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>
</ul>
</div>
</div>
</div>
<div class="homepageRight">
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="resourcesType">
<li class="mt-4"><a href="javascript:void(0);" class="homepagePostTypeAll postTypeGrey">全部动态</a></li>
<li class="mt-4"><a href="/users/8523/user_activities?type=current_user" class="homepagePostTypeMine postTypeGrey">我的动态</a> </li>
</ul>
</li>
</ul>
</div>
<div class="resources mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="50" height="50" alt="用户头像" /></a></div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO <a href="javascript:void(0);" class="newsBlue ml15">micROS研究团队 | 组织</a></div>
<div class="homepagePostTitle"><a href="javascript:void(0);" class="postGrey">如何打造一场罗永浩式的精彩演讲?</a></div>
<div class="homepagePostDate"> 发帖时间2015-11-02 11:25 </div>
<div class="homepagePostIntro">罗永浩已经把他的主题演讲成功变成了一次次的重大的媒体事件,这让科技界和营销界的从业者们羡慕不已。事实上,老罗不仅从乔布斯那里继承了乔式审美,设计哲学,同时也继承了乔布斯的演讲艺术。乔布斯是人类历史上最伟大的演讲者。在一次又一次的"罗氏演讲"中,我们可以清晰看到老罗对乔布斯演讲的拆解,学习,模仿。每一次的公开演讲,都是一堂案例级的营销课程,值得每一位有志于从事营销相关的朋友分析研究。<br />
下面,我们将从"故事"、"现场"、"准备"三个方面分析学习老罗的演讲技巧,教你如何打造一场"罗永浩式"的演讲。 </div>
<div class="homepagePostSetting">
<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>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复2</div>
<!--<div class="homepagePostReplyBannerTime">2015-07-31</div>-->
<!--<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a></div>-->
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="33" height="33" alt="用户头像" /></a></div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">黄井泉 学生</a> 2015-11-03 12:26</div>
<div class="homepagePostReplyContent">学习下!</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="33" height="33" alt="用户头像" /></a></div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">陈正东 学生</a> 2015-11-02 17:08</div>
<div class="homepagePostReplyContent">锤子手机,卖的就是情怀</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait mr15"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="33" height="33" alt="用户头像" /></a></div>
<div class="homepagePostReplyInputContainer">
<textarea class="homepagePostReplyInput fl mr15" placeholder="请输入回复"></textarea>
<a href="javascript:void(0);" class="homepagePostReplyEmotion mt5"></a> <a href="javascript:void(0);" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a> </div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
<div class="resources mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="50" height="50" alt="用户头像" /></a></div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr10">唐湘政</a> 创建了 <a href="javascript:void(0);" class="newsBlue ml10">micROS研究团队
| 组织</a></div>
<div class="homepagePostTitle"><a href="javascript:void(0);" class="postGrey">micROS研究团队 </a></div>
<div class="homepagePostDate"> 创建时间2015-10-29 11:23 </div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
</div>
<div id="RSide" class="fl">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</div>
<!--页面底部-->
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
</body>
</html>

View File

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header' %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
@ -76,7 +76,7 @@
<!--参数-->
<div class="pr_info_foot">
<%= l(:label_member) %><%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>
<%= l(:label_member) %><%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue', :id => 'project_members_number' %>
<span>|&nbsp;</span>
<%= l(:label_user_watcher) %><%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>

View File

@ -13,7 +13,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify'%>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify', 'org'%>
<%= javascript_include_tag "course","header",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -46,7 +46,7 @@
</div>
<div class="fl ml10">
<p class="homepageImageName hidden db mb5">
<%= @user.realname %>
<%= @user.realname.blank? ? @user.login : @user.realname %>
</p>
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
<span class="<%= @user.user_extensions.gender == 1 ? 'homepageImageSexWomen' : 'homepageImageSexMan' %> "></span>
@ -71,27 +71,38 @@
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
</div>
<div>
<div class="homepageImageBlock">
<div>
<%= link_to(@user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count,
{:controller => 'blogs', :action => 'index', :user_id => @user.id }, :class => 'homepageImageNumber',:id => 'user_score') %>
</div>
<div class="homepageImageText">
<%= link_to('博客',
{:controller => 'blogs', :action => 'index', :user_id => @user.id }, :class => 'homepageImageNumber',:id => 'user_score') %>
</div>
</div>
<div class="homepageVerDiv"></div>
<div class="homepageImageBlock">
<div id="watch_user_number_div">
<%= link_to User.watched_by(@user.id).count.to_s, {:controller=>"users", :action=>"user_watchlist",:id=>@user.id},:class=>"homepageImageNumber" %>
</div>
<div class="homepageImageText">关注</div>
<div class="homepageImageText">
<%= link_to '关注', {:controller=>"users", :action=>"user_watchlist",:id=>@user.id},:class=>"homepageImageNumber" %>
</div>
</div>
<div class="homepageVerDiv"></div>
<div class="homepageImageBlock">
<div id="fans_user_number_div">
<%= link_to @user.watcher_users.count.to_s, {:controller=>"users", :action=>"user_fanslist",:id=>@user.id},:class=>"homepageImageNumber", :id => "user_fans_number"%>
</div>
<div class="homepageImageText">粉丝</div>
</div>
<div class="homepageVerDiv"></div>
<div class="homepageImageBlock">
<div>
<%= link_to(format("%.2f" ,get_option_number(@user,1).total_score ).to_i,
{:controller => 'users', :action => 'show_new_score', :remote => true, :id => @user.id }, :class => 'homepageImageNumber',:id => 'user_score') %>
<div class="homepageImageText">
<%= link_to '粉丝', {:controller=>"users", :action=>"user_fanslist",:id=>@user.id},:class=>"homepageImageNumber", :id => "user_fans_number"%>
</div>
<div class="homepageImageText">积分</div>
</div>
<div class="cl"></div>
</div>
</div>
@ -103,7 +114,21 @@
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<% if is_current_user%>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<%=link_to "", new_course_path(:host=> Setting.host_course), :class => "homepageMenuSetting fr", :title => "新建课程"%>
<div class="courseMenu" id="courseMenu">
<ul>
<li class="courseMenuIcon" id="courseMenuIcon">
<ul class="topnav_course_menu" id="topnav_course_menu">
<li>
<%= link_to "新建课程", new_course_path(:host=> Setting.host_course), :class => "menuGrey"%>
</li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li>
<%= link_to "加入课程",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
</li>
</ul>
</li>
</ul>
</div>
<% else%>
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:remote => true, :title => "加入课程"%>
<% end%>
@ -201,5 +226,13 @@
<div class="cl"></div>
</div><!--floatbox end-->
</div>
<script type="text/javascript">
$("#courseMenu").mouseenter(function(){
$("#topnav_course_menu").show();
});
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
</script>
</body>
</html>

View File

@ -0,0 +1,14 @@
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
<ul style="list-style-type:none; margin:0; padding:0;">
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<p><span style="color:#1b55a7; font-weight:bold;"><%= @user.show_name %></span> 请求成为课程:<span style="color:#1b55a7; font-weight:bold;"><%=link_to @course.name, course_url(@course) %></span>的<%= @role.eql?('9') ? '老师': '教辅' %> </p>
<p><%=link_to user_message_url(@receive),user_message_url(@receive)%></p>
</span>
</li>
</ul>
<div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
</div>

View File

@ -0,0 +1,4 @@
<%= @user.show_name %>申请成为课程<%= @course.name %>的<%= @role.eql?('9') ? '老师': '教辅' %>
<%=link_to user_message_url(@receive),user_message_url(@receive)%>

View File

@ -4,6 +4,7 @@
<% else%>
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
hideOnLoad();
$("#project_members_number").html("<%= @project.members.count %>");
alert("<%= @succes_message%>");
<% end%>
<%elsif @course%>
@ -11,6 +12,8 @@
alert("<%= @create_member_error_messages%>");
<% else%>
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>");
$("#student_number").html("<%= studentCount(@course) %>");
alert("添加成功");
<% end%>
hideOnLoad();

View File

@ -1,7 +1,10 @@
<%if @project%>
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
$("#project_members_number").html("<%= @project.members.count %>");
// $('#tab-content-members').html('<%#= escape_javascript(render :partial => 'projects/settings/members') %>');
<%elsif @course%>
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>")
$("#student_number").html("<%= studentCount(@course) %>");
<%end%>
hideOnLoad();

View File

@ -2,6 +2,8 @@
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
<%elsif @course%>
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>")
$("#student_number").html("<%= studentCount(@course) %>");
<%end%>
hideOnLoad();

View File

@ -115,7 +115,7 @@
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% end %>
</div>
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">

View File

@ -17,7 +17,7 @@
<ul class="setting_left">
<li>登录名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>邮箱&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>身份&nbsp;:&nbsp;</li>
<li>身份&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(First Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(Last Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
@ -34,7 +34,10 @@
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<li>
<select onchange="showtechnical_title(this.value);" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
<select onchange="showtechnical_title(this.value);" required = true, nh_required="1" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
<option value="-1">
<%= l(:label_account_identity_choose) %>
</option>
<option value="0">
<%= l(:label_account_identity_teacher) %>
</option>
@ -61,6 +64,7 @@
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID),:style=>"60px" %></span>
<% end %>
</span>
<span id="identity_hint" style="display: none"></span>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
@ -170,7 +174,7 @@
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true" nh_required="1"></li>
<li class="ml2">
<a href="javascript:;" id="my_password_form_link" class="blue_btn fl">确认</a>
<!--<input type="submit" id="my_password_form_btn" style="display:none;"/>-->
<input type="submit" id="my_password_form_btn" style="display:none;"/>
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
</li>
</ul>
@ -701,6 +705,11 @@
$("#users_tb_2").click();
<% end %>
$('#my_account_form_link').click(function(e){
if($("#userIdentity").val() == -1 ) {
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
e.stopImmediatePropagation();
return;
}
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
$("#hint").html('<span style="color:red">学校必须是从下拉列表中选择的,不能手动修改</span>').show();
e.stopImmediatePropagation();

View File

View File

@ -0,0 +1,95 @@
<% @nav_dispaly_organization_label = 1
@nav_dispaly_forum_label = 1 %>
<%= error_messages_for 'organization' %>
<div class="organization_r_h02">
<h2 class="organization_h2"><%= l(:label_organization_new)%></h2>
</div>
<div class="hwork_new">
<ul>
<%= labelled_form_for @organization do |f| %>
<li class="ml45">
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_organization_name)%>&nbsp;&nbsp;</label>
<input type="text" name="organization[name]" id="organization_name" class="courses_input" maxlength="100" onkeyup="regex_organization_name();">
<span class="c_red" id="organization_name_notice" style="display: none;">项目名称不能为空</span>
</li>
<div class="cl"></div>
<div class="cl"></div>
<li class="ml45">
<label class="fl" >&nbsp;&nbsp;<%= l(:label_organization_description) %>&nbsp;&nbsp;</label>
<textarea name="organization[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
<div class="cl"></div>
</li>
<li>
<p style="display: none" >
<%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
</p>
</li>
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input id="organization_is_public" name="organization[is_public]" type="checkbox" value="1" checked="checked">
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。)</span>
<div class="cl"></div>
</li>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_organization();" >提交</a>
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
<div class="cl"></div>
</li>
<% end%>
</ul>
</div><!--talknew end-->
<div class="cl"></div>
<% html_title(l(:label_organization_new)) -%>
<script>
//////////////////////////////////////////////////////////////
//新建项目
//验证项目名称
function regex_organization_name()
{
var name = $.trim($("#organization_name").val());
if(name.length == 0)
{
$("#organization_name_notice").show();
return false;
}
else
{
$("#organization_name_notice").hide();
return true;
}
}
//提交新建项目
function submit_new_organization()
{
if(regex_organization_name())
{
$("#new_organization").submit();
}
}
$(function(){
$('#organization_new_type').change(function(){
var type = $('#organization_new_type').val();
if(type == '1'){
$(this).next().html("<%= l(:label_type_des_development)%>");
}
else if(type == '2'){
$(this).next().html("<%= l(:label_type_des_research)%>");
}
else if(type == '3'){
$(this).next().html("<%= l(:label_type_des_friend)%>");
}
// var p1=$(this).children('option:selected').val("研讨模式:面向小组研究,支持任务分工、论坛交流、资源分享等。");//这就是selected的值
// var p2=$('#param2').val();//获取本页面其他标签的值
})
})
</script>

View File

@ -0,0 +1,4 @@
<%= javascript_include_tag "jquery.infinitescroll.js" %>
<div class="project_r_h">
<h2 class="project_h2">组织活动</h2>
</div>

View File

@ -41,7 +41,7 @@
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% if visible_repository?(@project) %>
<div class="subNav">
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id, to: 'gitlab'}, :class => "f14 c_blue02" %>
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
</div>
<% end %>

View File

@ -73,13 +73,6 @@
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<% unless judge_main_repository(@project) %>
<li>
<label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li>
<% end %>
<li >
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
@ -89,11 +82,6 @@
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
<% end %>
</li>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
<%= f.password_field :upassword, :label=> "", :no_label => true%>
<span class="c_grey"><%= l(:label_upassword_info)%></span>
</li>
<div class="cl"></div>
</ul>
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml110"><%=l(:button_save)%></a>

View File

@ -1,32 +1,13 @@
<%= link_to @repository.identifier.present? ? h(@repository.identifier) : 'root',
{:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev },
:class=>"fl c_blue f14 fb" %>
<%
dirs = path.split('/')
if 'file' == kind
filename = dirs.pop
end
link_path = ''
dirs.each do |dir|
next if dir.blank?
link_path << '/' unless link_path.empty?
link_path << "#{dir}"
%>
/ <%= link_to h(dir), :action => 'show', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param(link_path), :rev => @rev %>
<% end %>
<% if filename %>
/ <%= link_to h(filename),
:action => 'changes', :id => @project, :repository_id => @repository.identifier_param,
:path => to_path_param("#{link_path}/#{filename}"), :rev => @rev %>
<% end %>
<%
# @rev is revsion or Git and Mercurial branch or tag.
# For Mercurial *tip*, @rev and @changeset are nil.
rev_text = @changeset.nil? ? @rev : format_revision(@changeset)
%>
<p class="fl f14 fb c_grey02"><%= "@ #{h rev_text}" unless rev_text.blank? %></p>
<div class="git_usr_title">
<span><%= link_to @repository.identifier.present? ? h(@repository.identifier) : 'root',
{:action => 'show', :id => @project,
:repository_id => @repository.identifier_param,
:path => nil, :rev => @rev },
:class => "repository-title-dec"
%>
/
<%=link_to @project.owner, user_path(@project.owner), :class => "repository-title-dec" %>
</span>
</div>
<% html_title(with_leading_slash(path)) -%>

View File

@ -1,17 +1,6 @@
<div class="autoscroll">
<table class="list entries" id="browser">
<thead>
<tr id="root">
<th><%= l(:field_name) %></th>
<th><%= l(:field_filesize) %></th>
<% if @repository.report_last_commit %>
<th><%= l(:label_revision) %></th>
<th><%= l(:label_age) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
<% end %>
</tr>
</thead>
<tbody>
<%= render :partial => 'dir_list_content' %>
</tbody>

View File

@ -7,6 +7,7 @@
<td style="padding-left: <%=18 * depth%>px;" class="<%=
@repository.report_last_commit ? "filename" : "filename_no_report" %>">
<% if entry.is_dir? %>
<%# 展开文件目录 %>
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
:action => 'show',
:id => @project,
@ -17,10 +18,11 @@
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'changes'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
{: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>

View File

@ -31,12 +31,7 @@
<%= f.text_field :login, :size => 30 %>
<input type="text" hidden="hidden">
</p>
<p>
<%= f.password_field :password, :size => 30, :name => 'ignore',
:value => ((@repository.new_record? || @repository.password.blank?) ? '' : ('x'*15)),
:onfocus => "this.value=''; this.name='repository[password]';",
:onchange => "this.name='repository[password]';" %>
</p>
</div>
<!--Ended by tanxianbo-->
<p>

View File

@ -26,7 +26,6 @@ border:none
<em class="info error"><%= l(:text_scm_command_not_available) %></em>
<% end %>
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p>
<input id="googleinputcache" size="30" type="text">
@ -36,8 +35,6 @@ border:none
<%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>
<!-- <p><%#= f.text_field :url, :size => 60, :required => true,:readonly=>true, :class=>'textbg'%></p> -->
<p><%= f.password_field :upassword, :required =>true, :label=> :field_password %>
<em class="info"><%= l(:label_upassword_info)%></em></p>
</div>
<p>
<%= submit_tag(@repository.new_record? ? l(:button_create) : l(:button_save)) %>

View File

@ -1,34 +1,33 @@
<% content_for :header_tags do %>
<%= javascript_include_tag 'repository_navigation' %>
<% end %>
<a href="javascript:void(0);" class="pic_stats fl ml20 mt3"></a>
<%= link_to l(:label_statistics),
<!--<a href="javascript:void(0);" class="pic_stats fl ml20 mt3"></a>-->
<%#= link_to l(:label_statistics),
{:action => 'stats', :id => @project, :repository_id => @repository.identifier_param},
:class => 'mt3 c_blue fl' if @repository.supports_all_revisions? %>
<div class="repositorytitle mr15">
<% content_for :header_tags do %>
<%= javascript_include_tag 'repository_navigation' %>
<% end %>
<%= form_tag({:action => controller.action_name,
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => nil},
{:method => :get, :id => 'revision_selector', :class => "fl c_grey02 ml5"}) do -%>
<!-- Branches Dropdown -->
<% if !@repository.branches.nil? && @repository.branches.length > 0 -%>
| <%= l(:label_branch) %>:
<%= select_tag :branch,
options_for_select([''] + @repository.branches, @rev),
:id => 'branch' %>
<% end -%>
<% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
| <%= l(:label_tag) %>:
<%= select_tag :tag,
options_for_select([''] + @repository.tags, @rev),
:id => 'tag' %>
<% end -%>
<% if @repository.supports_all_revisions? %>
| <%= l(:label_revision) %>:
<%= text_field_tag 'rev', @rev, :size => 8 %>
<% end %>
<% end -%>
<%= form_tag({:action => controller.action_name,
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => nil},
{:method => :get, :id => 'revision_selector'}) do -%>
<!-- Branches Dropdown -->
<% if !@repository.branches.nil? && @repository.branches.length > 0 -%>
<%= l(:label_branch) %>:
<%= select_tag :branch, options_for_select([''] + @repository.branches, @rev), :id => 'branch' %>
<% end -%>
<% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
<%= select_tag :tag, options_for_select([''] + @repository.tags, @rev), :id => 'tag', :style=>" display:none" %>
<% end -%>
<% if @repository.supports_all_revisions? %>
<%= hidden_field_tag 'rev', @rev, :size => 8 %>
<% end %>
<% end -%>
</div>

View File

@ -1,53 +1,51 @@
<% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %>
<%= if show_revision_graph && revisions && revisions.any?
indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid|
url_for(
:controller => 'repositories',
:action => 'revision',
:id => project,
:repository_id => @repository.identifier_param,
:rev => scmid)
end
render :partial => 'revision_graph',
:locals => {
:commits => indexed_commits,
:space => graph_space
}
end %>
<%= form_tag(
{:controller => 'repositories', :action => 'diff', :id => project,
:repository_id => @repository.identifier_param, :path => to_path_param(path)},
:method => :get
) do %>
<table class="list changesets">
<thead><tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:label_date) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
</tr></thead>
<!--<thead><tr>-->
<!--<th>#</th>-->
<!--<th></th>-->
<!--<th></th>-->
<!--<th><%= l(:label_date) %></th>-->
<!--<th><%= l(:field_author) %></th>-->
<!--<th><%= l(:field_comments) %></th>-->
<!--</tr></thead>-->
<tbody>
<% show_diff = revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
<tr class="changeset <%= cycle 'odd', 'even' %>">
<% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %>
<%= content_tag(:td, :class => 'id', :style => id_style) do %>
<%= link_to_revision(changeset, @repository) %>
<% end %>
<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%= h truncate(changeset.author.to_s, :length => 30) %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
</tr>
<% line_num += 1 %>
<div class="col-md-10 col-sm-12">
<ul class="bordered-list">
<li class="commit js-toggle-container">
<div class="commit-row-title">
<strong class="str-truncated">
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
</strong>
<div class="pull-right" title="修订号">
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
</div>
<div class="notes_count">
</div>
</div>
<div class="commit-row-info">
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>
提交于
<div class="committed_ago">
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time> &nbsp;
</div>
</div>
</li>
</ul>
</div>
<% end %>
</tbody>
</table>
<p style="padding-top: 10px;">
<%= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
</p>
<% end %>

View File

@ -0,0 +1,37 @@
<div class="overall-summary overall-summary-bottomless">
<div class="stats-switcher-viewport js-stats-switcher-viewport">
<div class="stats-switcher-wrapper">
<ul class="numbers-summary">
<li class="commits">
<a data-pjax="" href="/redmine/redmine/commits/0.6-stable">
<span class="octicon octicon-history"></span>
<span class="num text-emphasized">
<%=link_to @changesets.count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev}, :class => "num text-emphasized c_blue" %>
</span>
commits
</a>
</li>
<li>
<span class="octicon image-type"></span>
<span class="num text-emphasized" style="color: #269AC9">
<%= @repository.branches.count %>
</span>
branches
</li>
<li>
<span class="octicon octicon-organization"></span>
<span class="num text-emphasized">
<%=link_to @repository.committers.count, committers_repository_path(@repository), :class => "c_blue" %>
</span>
contributors
</li>
</ul>
</div>
</div>
</div>

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