Merge branch 'szzh' into dev_cxt2

This commit is contained in:
cxt 2015-07-28 16:14:04 +08:00
commit 3313adb13a
53 changed files with 1013 additions and 565 deletions

View File

@ -4,56 +4,50 @@ module Mobile
include Redmine::I18n
def self.course_dynamic_expose(field)
expose field do |c,opt|
if field == :update_time
(format_time(c[field]) if (c.is_a?(Hash) && c.key?(field)))
elsif field == :news_count
obj = nil
c[:dynamics].each do |d|
if d[:type] == 1
obj = d[:count]
end
end
obj
elsif field == :document_count
obj = nil
c[:dynamics].each do |d|
if d[:type] == 3
obj = d[:count]
end
end
obj
elsif field == :topic_count
obj = nil
c[:dynamics].each do |d|
if d[:type] == 2
obj = d[:count]
end
end
obj
elsif field == :homework_count
obj = nil
c[:dynamics].each do |d|
if d[:type] == 4
obj = d[:count]
end
end
obj
else
# if field == :news_count
# obj = nil
# c[:dynamics].each do |d|
# if d[:type] == 1
# obj = d[:count]
# end
# end
# obj
# elsif field == :document_count
# obj = nil
# c[:dynamics].each do |d|
# if d[:type] == 3
# obj = d[:count]
# end
# end
# obj
# elsif field == :topic_count
# obj = nil
# c[:dynamics].each do |d|
# if d[:type] == 2
# obj = d[:count]
# end
# end
# obj
# elsif field == :homework_count
# obj = nil
# c[:dynamics].each do |d|
# if d[:type] == 4
# obj = d[:count]
# end
# end
# obj
# else
c[field] if (c.is_a?(Hash) && c.key?(field))
end
# end
end
end
course_dynamic_expose :type
course_dynamic_expose :count
course_dynamic_expose :course_name
course_dynamic_expose :course_term
course_dynamic_expose :course_time
course_dynamic_expose :course_id
course_dynamic_expose :course_img_url
course_dynamic_expose :message
course_dynamic_expose :update_time
course_dynamic_expose :count
course_dynamic_expose :news_count
course_dynamic_expose :document_count
course_dynamic_expose :topic_count
@ -63,62 +57,32 @@ module Mobile
course_dynamic_expose :current_user_is_member
course_dynamic_expose :current_user_is_teacher
expose :documents,using:Mobile::Entities::Attachment do |f,opt|
obj = nil
f[:dynamics].each do |d|
if d[:type] == 3
obj = d[:documents]
end
end
obj
end
# expose :documents,using:Mobile::Entities::Attachment do |f,opt|
# obj = nil
# f[:dynamics].each do |d|
# if d[:type] == 3
# obj = d[:documents]
# end
# end
# obj
# end
expose :topics,using:Mobile::Entities::Message do |f,opt|
obj = nil
f[:dynamics].each do |d|
if d[:type] == 2
obj = d[:topics]
end
end
obj
f[:topics]
end
expose :homeworks,using:Mobile::Entities::Homework do |f,opt|
obj = nil
f[:dynamics].each do |d|
if d[:type] == 4
obj = d[:homeworks]
end
end
obj
f[:homeworks]
end
expose :news,using:Mobile::Entities::News do |f,opt|
obj = nil
f[:dynamics].each do |d|
if d[:type] == 1
obj = d[:news]
end
end
obj
f[:news]
end
expose :better_students,using:Mobile::Entities::User do |f,opt|
obj = nil
f[:dynamics].each do |d|
if d[:type] == 6
obj = d[:better_students]
end
end
obj
f[:better_students]
end
expose :active_students,using:Mobile::Entities::User do |f,opt|
obj = nil
f[:dynamics].each do |d|
if d[:type] == 7
obj = d[:active_students]
end
end
obj
f[:active_students]
end
end

View File

@ -337,6 +337,19 @@ class AdminController < ApplicationController
format.html
end
end
#学校列表
def schools
@school_name = params[:school_name]
if @school_name
@schools = School.where("name like '%#{@school_name}%'")
else
@schools = School.all
end
respond_to do |format|
format.html
end
end
#移动端版本管理
def mobile_version
@versions = PhoneAppVersion.reorder('created_at desc')

View File

@ -604,7 +604,7 @@ class CoursesController < ApplicationController
def toggleCourse
@course_prefs = Course.find_by_extra(@course.extra)
unless (@course_prefs.student != User.current || User.current.admin?)
unless (User.current.allowed_to?(:as_teacher,@course_prefs) || User.current.admin?)
render_403
end
end

View File

@ -40,9 +40,9 @@ class HomeworkCommonController < ApplicationController
# @homework_detail_programing = HomeworkDetailPrograming.new
# @homework.homework_detail_programing = @homework_detail_programing
# end
# respond_to do |format|
# format.html
# end
respond_to do |format|
format.html
end
end
#新建作业下一步
@ -144,6 +144,8 @@ class HomeworkCommonController < ApplicationController
end
if homework.save
homework_detail_programing.save if homework_detail_programing
homework_detail_manual.save if homework_detail_manual
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
@ -254,7 +256,6 @@ class HomeworkCommonController < ApplicationController
client.request(request)
end
result = JSON.parse(res.body)
homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
end
@homework.save_attachments(params[:attachments])

View File

@ -71,13 +71,12 @@ class NewsController < ApplicationController
scope = @course ? @course.news.course_visible : News.course_visible
@news_count = scope.count
#@news_pages = Paginator.new @news_count, @limit, params['page']
#@offset ||= scope_page.offset
@q = params[:subject]
if params[:subject].nil?
scope_order = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC")
else
scope_order = scope.where("news.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course],
scope_order = scope.where("#{News.table_name}.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC")
end

View File

@ -136,12 +136,20 @@ class PollController < ApplicationController
}
@poll_questions.poll_answers.new question_option
end
end
# 如果是插入的话那么从插入的这个id以后的question_num都将要+1
if params[:quest_id]
@is_insert = true
@poll.poll_questions.where("question_number > #{params[:quest_num].to_i}").update_all(" question_number = question_number + 1")
@poll_question_num = params[:quest_num].to_i
@poll_questions.question_number = params[:quest_num].to_i + 1
end
if @poll_questions.save
respond_to do |format|
format.js
end
end
end
#修改题目

View File

@ -449,6 +449,8 @@ update
def stats
@project_id = params[:id]
@repository_id = @repository.identifier
# 提交次数统计
@status_commit_count = Changeset.count(:conditions => ["#{Changeset.table_name}.repository_id = ?", @repository.id])
render :layout => 'base_projects'
end
@ -459,6 +461,12 @@ update
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"
@ -617,6 +625,123 @@ update
)
graph.burn
end
# 用户最近一年的提交次数
def graph_author_commits_per_month(repository)
@date_to = Date.today
@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])
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}
commits_data = commits_by_author.collect {|r| r.last}
fields = fields + [""]*(10 - fields.length) if fields.length<10
commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
# Remove email adress in usernames
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_author_commits_year),
:show_graph_title => true,
:no_css => true
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_commit_count)
)
graph.burn
end
# 用户最近六个月的提交次数
def author_commits_six_month(repository)
@date_to = Date.today
@date_from = @date_to << 6
@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])
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}
commits_data = commits_by_author.collect {|r| r.last}
fields = fields + [""]*(10 - fields.length) if fields.length<10
commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
# Remove email adress in usernames
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_author_commits_six_month),
:show_graph_title => true
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_commit_count)
)
graph.burn
end
# 最近六个月代码量统计
def author_code_six_month(repository)
@date_to = Date.today
@date_from = @date_to << 6
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:group => :committer, :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(40)
all_author = []
commits_by_author.each do |cba|
all_author << cba.first
end
# all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') }
all_author = all_author.collect {|c| c.split.first }
commits_by_author = repository.commits(all_author, "#{@date_from}", "#{@date_to}", repository.id == 150 ? "szzh" : 'master')
fields = commits_by_author.collect {|r| r.first}
commits_data = commits_by_author.collect {|r| r.last}
fields = fields + [""]*(10 - fields.length) if fields.length<10
commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
# Remove email adress in usernames
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_author_code_six_month),
:show_graph_title => true
)
graph.add_data(
:data => commits_data,
:title => l(:lable_revision_code_count)
)
graph.burn
end
def check_hidden_repo
project = Project.find(params[:id])
if !User.current.member_of?(project)

View File

@ -4,28 +4,21 @@ class SchoolController < ApplicationController
def upload
uploaded_io = params[:logo]
school_id = 0
schools = School.where("name = ?", params[:school])
schools.each do |s|
school_id = s.id
end
school_id ||= params[:id]
unless uploaded_io.nil?
File.open(Rails.root.join('public', 'images', 'school', school_id.to_s+'.png'), 'wb') do |file|
file.write(uploaded_io.read)
end
s1 = School.find(school_id)
s1.logo_link = '/images/school/'+school_id.to_s+'.png'
s1.save
end
redirect_to admin_schools_url(:school_name => params[:school_name])
end
def upload_logo
@school = School.find params[:id]
@school_name = params[:school_name]
end
#获取制定学校开设的课程数

View File

@ -112,39 +112,20 @@ class UsersController < ApplicationController
#added by young
def user_projects
#add by huang
unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
render_404
return
end
end
#end
# if User.current.admin?
# @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}")
# else
# cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
# @memberships = @user.memberships.all(:conditions => cond)
# end
#events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
#@events_by_day = events.group_by(&:event_date)
# @state = 0
limit = 10;
query = Project.joins("join members m on #{Project.table_name}.id=m.project_id")
query = query.where("m.user_id = ? and #{Project.table_name}.project_type=?",@user.id,Project::ProjectType_project)
projects = @user.projects.visible.order("updated_on desc")
if(params[:status] == '1')
query = query.where("#{Project.table_name}.user_id = ?",@user.id);
projects = projects.where("user_id = ?",@user.id)
elsif(params[:status] == '2')
query = query.where("#{Project.table_name}.user_id <> ?",@user.id);
projects = projects.where("user_id <> ?",@user.id)
end
@obj_count = query.count();
@obj_pages = Paginator.new @obj_count,limit,params['page']
@list = query.order("#{Project.table_name}.updated_on desc,#{Project.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@params = params
@list = paginateHelper projects,10
@params = params[:status]
respond_to do |format|
format.html{render :layout=>'base_users_new'}
format.api
@ -262,57 +243,20 @@ class UsersController < ApplicationController
def user_courses
unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
if !@user.active?
render_404
return
end
end
#@user.coursememberships.all(:conditions => Course.visible_condition(User.current))
limit = 10;
query = Course.joins("join members m on #{Course.table_name}.id=m.course_id")
query = query.where("m.user_id = ?",@user.id)
courses = @user.courses.visible.order("created_at desc")
if(params[:status] == '1')
query = query.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now);
courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now)
elsif(params[:status] == '2')
query = query.where("endup_time < ?",Time.now);
courses = courses.where("endup_time < ?",Time.now)
end
@obj_count = query.count();
@obj_pages = Paginator.new @obj_count,limit,params['page']
@list = query.order("#{Course.table_name}.updated_at desc,#{Course.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@params = params
@list = paginateHelper courses,10
@params = params[:status]
render :layout=>'base_users_new'
# if User.current == @user || User.current.admin?
# membership = @user.coursememberships.all
# else
# membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current))
# end
#
# membership.sort! {|older, newer| newer.created_on <=> older.created_on }
# @memberships = []
# membership.collect { |e|
# @memberships.push(e)
# }
# ## 判断课程是否过期 [需封装]
# @memberships_doing = []
# @memberships_done = []
# #now_time = Time.now.year
# @memberships.map { |e|
# #end_time = e.course.get_time.year
# isDone = course_endTime_timeout?(e.course)
# if isDone
# @memberships_done.push e
# else
# @memberships_doing.push e
# end
# }
# respond_to do |format|
# format.html
# format.api
# end
end
# modified by fq
@ -482,95 +426,6 @@ class UsersController < ApplicationController
render :layout=>nil
end
# def user_course_activities
# @list = []
# lastid = nil
# if params[:lastid]!=nil && !params[:lastid].empty?
# lastid = params[:lastid];
# end
#
# user_ids = []
# if @user == User.current
# watcher = User.watched_by(@user)
# watcher.push(User.current)
# user_ids = watcher.map{|x| x.id}
# else
# user_ids << @user.id
# end
#
# query_rec_count = 8
# query_times = 10 #query_times次没查到query_rec_count条记录就不查了
# query_i = 0;
# while( true )
# query_i = query_i+1
# if(query_i>query_times)
# break
# end
# query = Activity.where(user_id: user_ids)
# if(lastid != nil)
# query = query.where("id < ?",lastid)
# end
# lastid,item_list = query_activities(query,'course');
# for item in item_list
# @list << item
# if @list.count() >= query_rec_count
# break
# end
# end
# if @list.count() >= query_rec_count
# break
# end
# if lastid == nil
# break
# end
# end
# render :layout=>nil
# end
#
# def user_project_activities
# @list = []
# lastid = nil
# if params[:lastid]!=nil && !params[:lastid].empty?
# lastid = params[:lastid];
# end
#
# user_ids = []
# if @user == User.current
# watcher = User.watched_by(@user)
# watcher.push(User.current)
# user_ids = watcher.map{|x| x.id}
# else
# user_ids << @user.id
# end
#
# query_rec_count = 8
# query_times = 10 #query_times次没查到query_rec_count条记录就不查了
# query_i = 0;
# while( true )
# query_i = query_i+1
# if(query_i>query_times)
# break
# end
# query = Activity.where(user_id: user_ids)
# if(lastid != nil)
# query = query.where("id < ?",lastid)
# end
# lastid,item_list = query_activities(query,'project');
# for item in item_list
# @list << item
# if @list.count() >= query_rec_count
# break
# end
# end
# if @list.count() >= query_rec_count
# break
# end
# if lastid == nil
# break
# end
# end
# render :action=>'user_course_activities',:layout=>nil
# end
def user_course_activities
lastid = nil
if params[:lastid]!=nil && !params[:lastid].empty?
@ -629,7 +484,7 @@ class UsersController < ApplicationController
query = query.where("#{Activity.table_name}.id < ?",lastid)
end
query = query.order("#{Activity.table_name}.id desc")
@list = query_activities(query);
@list = query_activities(query)
render :action=>'user_course_activities',:layout=>nil
end

View File

@ -100,44 +100,6 @@ class WelcomeController < ApplicationController
@course_page = FirstPage.find_by_page_type('course')
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
@logoLink ||= logolink()
##3-8月份为查找春季课程9-2月份为查找秋季课程
#month_now = Time.now.strftime("%m").to_i
#year_now = Time.new.strftime("%Y").to_i
#(month_now >= 3 && month_now < 9) ? course_term = l(:label_spring) : course_term = l(:label_autumn)
##year_now -= 1 if year_now < 3
#@school_id.nil? ? @cur_school_course = [] : @cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term)
##未登录或者当前学校未开设课程
#if @cur_school_course.empty?
# @has_course = false
# User.current.logged? ? course_count = 9 : course_count = 10
# @cur_school_course += find_all_new_hot_course(course_count, @school_id, year_now, course_term)
# while @cur_school_course.count < 9 do
# if course_term == l(:label_spring)
# course_term = l(:label_autumn)
# year_now -= 1
# else
# course_term = l(:label_spring)
# end
# @cur_school_course += find_all_new_hot_course((10-@cur_school_course.count), nil, year_now, course_term)
# end
#else
# if @cur_school_course.count < 9
# @has_course = false
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, @school_id, year_now, course_term)
# if @cur_school_course.count < 9
# if course_term == l(:label_spring)
# course_term = l(:label_autumn)
# year_now -= 1
# else
# course_term = l(:label_spring)
# end
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, nil, year_now, course_term)
# end
# else
# @has_course = true
# end
#end
end
def logolink()

View File

@ -1,5 +1,11 @@
# encoding: utf-8
module ApiHelper
ONE_MINUTE = 60 * 1000
ONE_HOUR = 60 * ONE_MINUTE
ONE_DAY = 24 * ONE_HOUR
ONE_MONTH = 30 * ONE_DAY
ONE_YEAR = 12 * ONE_MONTH
#获取用户的工作单位
def get_user_work_unit user
work_unit = ""
@ -163,5 +169,37 @@ module ApiHelper
end
# 获取当前时间
def time_from_now time
lastUpdateTime = time.to_i*1000
currentTime = Time.now.to_i*1000
timePassed = currentTime - lastUpdateTime;
timeIntoFormat = 0
updateAtValue = ""
if timePassed < 0
updateAtValue = "时间有问题"
elsif timePassed < ONE_MINUTE
updateAtValue = "一分钟前"
elsif timePassed < ONE_HOUR
timeIntoFormat = timePassed / ONE_MINUTE
updateAtValue = timeIntoFormat.to_s + "分钟前"
elsif (timePassed < ONE_DAY)
timeIntoFormat = timePassed / ONE_HOUR
updateAtValue = timeIntoFormat.to_s + "小时前"
elsif (timePassed < ONE_MONTH)
timeIntoFormat = timePassed / ONE_DAY
updateAtValue = timeIntoFormat.to_s + "天前"
elsif (timePassed < ONE_YEAR)
timeIntoFormat = timePassed / ONE_MONTH
updateAtValue = timeIntoFormat.to_s + "个月前"
else
timeIntoFormat = timePassed / ONE_YEAR
updateAtValue = timeIntoFormat.to_s + "年前"
end
updateAtValue
end
end

View File

@ -236,13 +236,14 @@ module RepositoriesHelper
# 判断项目是否有主版本库
def judge_main_repository(pro)
if pro.repositories.blank?
return false
status = false
else
pro.repositories.sort.each do |rep|
rep.is_default?
return true
pro.repositories.each do |rep|
status = true and break if rep.is_default?
status = false
end
end
status
end
# def cvs_field_tags(form, repository)
# content_tag('p', form.text_field(

View File

@ -364,14 +364,15 @@ module UsersHelper
end
def query_activities(query)
list = query.limit(8).all
result = [];
list = query.limit(13).all
result = []
for item in list
container = get_activity_container(item)
result << { :item=>item,:e=>container }
end
return result
result
end
def get_activity_container activity
return activity.activity_container
end

View File

@ -38,6 +38,12 @@ class Repository::Git < Repository
'Git'
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

View File

@ -654,36 +654,42 @@ class CoursesService
return
end
if current_user == @user || current_user.admin?
membership = @user.coursememberships.page(1).per(15)
membership = @user.coursememberships
else
membership = @user.coursememberships.page(1).per(15).all(:conditions => Course.visible_condition(current_user))
membership = @user.coursememberships.all(:conditions => Course.visible_condition(current_user))
end
if membership.nil? || membership.count == 0
raise l(:label_no_courses, :locale => get_user_language(current_user))
end
membership.sort! { |older, newer| newer.created_on <=> older.created_on }
#membership.sort! { |older, newer| newer.created_on <=> older.created_on }
#定义一个数组集合存放hash数组该hash数组包括课程的信息并包含课程的最新发布的资源最新的讨论区留言最新的作业最新的通知
result = []
#对用户所有的课程进行循环,找到每个课程最新发布的资源,最新的讨论区留言,最新的作业,最新的通知,并存进数组
membership.each do |mp|
course = mp.course
latest_course_dynamics = []
notices_count = 0
topic_count = 0
topics = nil
homeworkss = nil
notices = nil
# 课程通知
latest_news = course.news.page(1).per(2).order("created_on desc")
unless latest_news.first.nil?
latest_course_dynamics << {:type => 1, :time => latest_news.first.created_on,:count=>course.news.count,
:news => latest_news.all}
notices_count = course.news.count
notices = latest_news.all
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?
latest_course_dynamics << {:type => 2, :time => latest_message.first.created_on, :count =>course.boards.nil? ? 0 : course.boards.first.topics.count,
:topics => latest_message.all}
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?
@ -694,14 +700,17 @@ class CoursesService
#课程作业 已经交的学生列表暂定显示6人未交的学生列表作业的状态
homeworks = course.homework_commons.page(1).per(2).order('created_at desc')
unless homeworks.first.nil?
latest_course_dynamics << {:type => 4, :time => homeworks.first.updated_at, :count=>course.homework_commons.count , :homeworks => homeworks}
homeworkss = homeworks
latest_course_dynamics << {:time => homeworks.first.updated_at}
end
latest_course_dynamics.sort! { |order, newer| newer[:time] <=> order[:time] }
# 课程学霸 学生总分数排名靠前的5个人
homework_count = course.homework_commons.count
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 = #{course.id}) GROUP BY student_works.user_id ORDER BY score desc limit 0,4"
better_students = User.find_by_sql(sql)
# 找出在课程讨论区发帖回帖数最多的
active_students = []
sql1 = " select users.*,count(author_id)*2 active_count from messages " <<
@ -710,20 +719,41 @@ class CoursesService
" GROUP BY messages.author_id ORDER BY count(author_id) desc " <<
" limit 0,4"
active_students = User.find_by_sql(sql1)
if homework_count != 0 && !better_students.empty?
latest_course_dynamics <<{:type=> 6,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:better_students=> better_students}
latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"}
end
unless active_students.empty?
latest_course_dynamics <<{:type=> 7,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:active_students=>active_students}
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,:message => "", :dynamics => latest_course_dynamics,
: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=>latest_course_dynamic[:time].to_time}
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
#返回数组集合
result.sort! { |order, newer| newer[:time] <=> order[:time] }
result
end

View File

@ -0,0 +1,50 @@
<h3 style="float: left">
<%=l(:label_school_plural)%>
</h3>
<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %>
<%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%>
<input style="float: right;margin-right: 10px;" id="v_subject" placeholder="学校名称" type="text" name="school_name" value="<%= @school_name%>">
<% end %>
<div class="cl"></div>
<div class="autoscroll" style="margin-top: 40px;">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 50px;">
序号
</th>
<th style="width: 100px;">
LOGO
</th>
<th>
学校名称
</th>
<th style="width: 100px;"></th>
</tr>
</thead>
<tbody>
<% @schools.each do |school|%>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align:center;vertical-align: middle;">
<%= school.id %>
</td>
<td align="center">
<%= image_tag(school.logo_link,width:40,height:40) %>
</td>
<td style="text-align:center;vertical-align: middle;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=school.name%>'>
<span>
<%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %>
</span>
</td>
<td class="buttons" style="vertical-align: middle;">
<%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %>
<%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
</td>
</tr>
<% end%>
</tbody>
</table>
</div>
<% html_title(l(:label_project_plural)) -%>

View File

@ -43,7 +43,7 @@
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
</div>
</span>
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span>
</a>

View File

@ -31,7 +31,7 @@
<% if @canShowCode%>
<%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, :id => 'update_group_'+group.id.to_s) do %>
<span id="edit_group_<%= group.id %>" style="display:none; vertical-align: middle;" class=" f_l">
<input type="text" id="group_name_<%= group.id%>" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="text" id="group_name_<%= group.id%>" name="group_name" size="20" class="isTxt w90 f_l" maxlength="20" />
<input type="button" class="submit f_l" onclick="edit_group('group_name_<%= group.id%>','<%= valid_ajax_course_path%>','<%= @course.id%>','<%= group.id%>');"/>
</span>
<% end %>
@ -47,7 +47,7 @@
<li >
<span id="new_group_name" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_tag( addgroups_course_path(@course), method: 'get',:remote=>true,:id => 'add_group_name') do %>
<input type="text" id="group_name" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="text" id="group_name" name="group_name" size="20" class="isTxt w90 f_l" maxlength="20" />
<input type="button" class="submit f_l" onclick="add_group('<%= valid_ajax_course_path%>','<%= @course.id%>');"/>
<% end %>
</span>

View File

@ -48,7 +48,7 @@
</div>
<div class="cl"></div>
<% if homework.homework_type == 2 && homework.homework_detail_programing%>
<% if homework.homework_type == 2 && homework.homework_detail_programing && @is_teacher%>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class="<%= cycle("", "b_grey") %>">
@ -71,18 +71,30 @@
<% end%>
</tbody>
</table>
<% end%>
<div class="cl"></div>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 开发语言:</span>
<div class="fl">
<% if homework.homework_detail_programing.language.to_i == 1%>
C
<% elsif homework.homework_detail_programing.language.to_i == 2%>
C++
<% end%>
</div>
</div>
<div class="cl"></div>
<% end%>
<% unless homework.attachments.empty?%>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 附件:</span>
<div class="fl mb5">
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework.attachments} %>
</div>
<% end%>
</div>
<div class="cl"></div>
<% end%>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>

View File

@ -11,7 +11,7 @@
<%= hidden_field_tag "course",@course.id%>
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
</div><!--hwork_new end-->
@ -22,7 +22,7 @@
<%= hidden_field_tag "homework_common[homework_type]","2"%>
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
</div><!--hwork_new end-->

View File

@ -34,7 +34,7 @@
</li>
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user },
{:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user},
{:class => 'my-message'} if User.current.logged?%>
</li>
</ul>

View File

@ -80,12 +80,14 @@
<div class="cl"></div>
<div>
<% if @project.project_type == 0 %>
<% unless project_scores(@project) == 0 %>
<span class="fb f14 "><%= l(:label_project_score)%> :</span>
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score',
:remote => true,
:id => @project.id}, :class => "c_orange f14" ) %>
<% end %>
<% end %>
</div>
<!--参数-->

View File

@ -126,52 +126,110 @@
<div class="cl"></div>
</div>
<% if @center_flag %>
<div class="subNavBox ">
<div class="subNav "><a href="<%=url_for(:controller => 'users', :action => 'show',:id=>@user.id)%>" class=" f14 c_blue02">动态</a></div>
<div class="subNav subNav_jiantou">
<div class="subNav ">
<a href="<%=url_for(:controller => 'users', :action => 'show',:id=>@user.id)%>" class=" f14 c_blue02">
动态
</a>
</div>
<% if @center_flag %>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_courses',:id=>@user.id)%>" class=" f14 c_blue02">
我的课程
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.count%>)</span>
</a>
</div>
<div class="subNav subNav_jiantou">
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_projects',:id=>@user.id)%>" class=" f14 c_blue02">
我的项目
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.count%>)</span>
</a>
</div>
<div class="subNav "><a href="<%= url_for(:controller => 'my', :action => 'account') %>" class=" f14 c_blue02">编辑资料</a></div>
</div><!--侧导航 end-->
<div class="subNav ">
<a href="<%= url_for(:controller => 'my', :action => 'account') %>" class=" f14 c_blue02">编辑资料</a>
</div>
<% else%>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_courses',:id=>@user.id)%>" class=" f14 c_blue02">
TA的课程
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.visible.count%>)</span>
</a>
</div>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_projects',:id=>@user.id)%>" class=" f14 c_blue02">
TA的项目
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.visible.count%>)</span>
</a>
</div>
<% end %>
<div class="subNav "><a href="javascirpt:void(0);" class=" f14 c_blue02">留言</a></div>
</div><!--侧导航 end-->
<div class="cl"></div>
<div class="leftbox mt10">
<ul class="leftbox_ul_left">
<% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %>
<% if(get_create_course_count(@user)) == 0 %>
<li>创建课程&nbsp;:</li>
<% end %>
<% if(get_homework_commons_count(@user)) == 0 %>
<li>发布作业&nbsp;:</li>
<% end %>
<% end %>
<% if (get_join_course_count(@user) != 0) %>
<li>加入课程&nbsp;:</li>
<% end %>
<% if @user.user_extensions.identity == 0 %>
<li>参加匿评&nbsp;:</li>
<% end %>
<% if (get_projectandcourse_attachment_count(@user) != 0) %>
<li>发布资源&nbsp;:</li>
<% end %>
<% if (get_create_project_count(@user) != 0) %>
<li>创建项目&nbsp;:</li>
<% end %>
<% if (get_join_project_count(@user) != 0) %>
<li>加入项目&nbsp;:</li>
<% end %>
<% if (get_create_issue_count(@user) != 0) %>
<li>发布缺陷&nbsp;:</li>
<% end %>
<% if (get_resolve_issue_count(@user) != 0) %>
<li>解决缺陷&nbsp;:</li>
<% end %>
</ul>
<ul class="leftbox_ul_right c_dgrey">
<% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %>
<% if(get_create_course_count(@user)) == 0 %>
<li><%= get_create_course_count(@user) %></li>
<% end %>
<% if(get_homework_commons_count(@user)) == 0 %>
<li><%= get_homework_commons_count(@user) %></li>
<% end %>
<% end %>
<% if (get_join_course_count(@user) != 0) %>
<li><%= get_join_course_count(@user) %></li>
<% end %>
<% if @user.user_extensions.identity == 0 %>
<li><%= get_anonymous_evaluation_count(@user) %></li>
<% end %>
<% if (get_projectandcourse_attachment_count(@user) != 0) %>
<li><%= get_projectandcourse_attachment_count(@user) %></li>
<% end %>
<% if (get_create_project_count(@user) != 0) %>
<li><%= get_create_project_count(@user) %></li>
<% end %>
<% if (get_join_project_count(@user) != 0) %>
<li><%= get_join_project_count(@user) %></li>
<% end %>
<% if (get_create_issue_count(@user) != 0) %>
<li><%= get_create_issue_count(@user) %></li>
<% end %>
<% if (get_resolve_issue_count(@user) != 0) %>
<li><%= get_resolve_issue_count(@user) %></li>
<% end %>
</ul>
<div class="cl"></div>
</div>

View File

@ -24,8 +24,8 @@
<% end %>
</div>
<div class="problem_search fr" >
<%= form_tag({:controller => 'news', :action => 'index', :course_id => @course },:remote=>'true', :method => :get,:id=>"news_query_form", :class => 'query_form') do %>
<input class="problem_search_input fl" id="v_subject" placeholder="通知主题" type="text" name="subject" value="" onkeypress="" onkeydown="">
<%= form_tag({:controller => 'news', :action => 'index', :course_id => @course }, :method => :get,:id=>"news_query_form", :class => 'query_form') do %>
<input class="problem_search_input fl" id="v_subject" placeholder="通知主题" type="text" name="subject" value="<%= @q%>" onkeypress="" onkeydown="">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_search();" >搜索</a>
<% end %>
</div><!--problem_search end-->
@ -34,7 +34,7 @@
<div id="news_list">
<%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %>
<div>
</div>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>

View File

@ -1,5 +1,6 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<!--新建单选start-->
<% insert_begin = insert_begin %>
<div class="ur_editor radio">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>

View File

@ -2,27 +2,227 @@
<script type="text/javascript">
//编辑问卷描述之后
var popWindow ; //弹出框的引用
function edit_head(){
$("#polls_description").val($("#polls_description_div").html());
}
$(function(){
//点击空白处
$(document).bind('click',function(e){
//弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏
if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1
popWindow.css('display', 'none');
}
});
})
function add_MC(){
function chooseQuestionType(quest_type,quest_id){
//quest_type 分为 mc mcq single multi
//quest_id 是quetion的id 下同
if(popWindow){
popWindow.css('display', 'none');
}
popWindow = $("#div_"+quest_type+"_"+quest_id);
$("#div_"+quest_type+"_"+quest_id).click(function(e){
e.stopPropagation(); //组织冒泡到document.body中去
});
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);
$("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10);
if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') {
$("#div_"+quest_type+"_"+quest_id).css('display', 'none');
}
else{
$("#div_"+quest_type+"_"+quest_id).css('display', 'block');
}
}
function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus();
}
function add_MCQ(){
}
function insert_MC(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
' <div class="ur_editor radio"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
}
function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title").focus();
}
function insert_MCQ(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor checkbox">'+
'<div class="ur_editor_title">'+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除"" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
}
function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title").focus();
}
function insert_SINGLE(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor text ">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
}
function add_mulit(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus();
}
function insert_MULIT(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor textarea">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="4"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_toolbar">'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
}
//添加标题时确定按钮
function add_poll_question(doc)
{

View File

@ -1,3 +1,6 @@
<script>
</script>
<div class="ur_question_item radio ur_editor02">
<div class="ur_title">
<span class="title_index">
@ -9,9 +12,11 @@
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=poll_question.id%>" onclick="chooseQuestionType('mc',<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" >
@ -30,3 +35,14 @@
</table>
</div>
</div><!--单选题显示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mc_<%=poll_question.id%>">
</div>
<div id="div_mc_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mc',<%=poll_question.id%>);insert_MC('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mc',<%=poll_question.id%>);insert_MCQ('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mc',<%=poll_question.id%>);insert_SINGLE('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mc',<%=poll_question.id%>);insert_MULIT('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -12,6 +12,7 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=poll_question.id%>" onclick="chooseQuestionType('mcq',<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table">
@ -30,3 +31,14 @@
</table>
</div>
</div><!--多选题显示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mcq_<%=poll_question.id%>">
</div>
<div id="div_mcq_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_MC('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_MCQ('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_SINGLE('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_MULIT('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -13,9 +13,21 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mulit_<%=poll_question.id%>" onclick="chooseQuestionType('mulit',<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<textarea class="ur_textbox" rows="5" cols="60"></textarea>
</div>
</div>
</div><!--多行展示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mulit_<%=poll_question.id%>">
</div>
<div id="div_mulit_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_MC('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_MCQ('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_SINGLE('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_MULIT('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -12,8 +12,20 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_single_<%=poll_question.id%>" onclick="chooseQuestionType('single',<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
</div>
</div><!--单行文字展示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_single_<%=poll_question.id%>">
</div>
<div id="div_single_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('single',<%=poll_question.id%>);insert_MC('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('single',<%=poll_question.id%>);insert_MCQ('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('single',<%=poll_question.id%>);insert_MULIT('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,4 +1,8 @@
<% if @is_insert %>
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
<% else %>
$("#new_poll_question").html("");
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<% if @poll_questions.question_type == 1%>" +
@ -23,4 +27,4 @@ $("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<% end%>" +
"</div>" +
"</div>");
<% end %>

View File

@ -5,27 +5,27 @@
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#in{}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 120px;padding-bottom: 10px;font-size: 14px;">云化部署中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div>
<p style="padding-left: 100px;padding-bottom: 10px;font-size: 14px;padding-top: 10px;">云化部署中....</p>
<div>
<div id="in" style="width:0%"></div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",50);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
ba=setInterval("begin()",60);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
document.getElementById("in").style.width="";
document.getElementById("in").innerHTML="";}
else
{
clearInterval(ba);

View File

@ -1,11 +1,30 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_statistics) %></h2>
</div>
<p>
<% if @status_commit_count ==0 %>
<div class="flash notice">该项目目前还没有提交过代码!</div>
<% else %>
<div class="riviseRed fl"></div><div class="fl">修订 是版本库的提交次数, 显示为橘红色。</div><br>
<div class="changeBlue fl"></div><div class="fl">变更 是对版本库中文件的修改次数, 显示为蓝色。</div>
<p style="padding-top:35px;">
<%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %>
</p>
<p style="padding-top: 50px;">
</p>
<p style="padding-top: 50px;">
<%# 用户每月提交代码次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %>
</p>
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
<% html_title(l(:label_repository), l(:label_statistics)) -%>
</p>
<p style="padding-top: 50px;">
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的提交次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的代码量 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %>
</p>
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
<% html_title(l(:label_repository), l(:label_statistics)) -%>
<% end %>

View File

@ -1,5 +1,28 @@
<%= form_tag({action: :upload},method: "post", multipart: true) do %>
<%= text_field_tag 'school'%>
<%= file_field_tag 'logo' %>
<%= submit_tag('Upload') %>
<script>
function showPreview(source) {
var file = source.files[0];
if(window.FileReader) {
var fr = new FileReader();
fr.onloadend = function(e) {
document.getElementById("avatar_image").src = e.target.result;
};
fr.readAsDataURL(file);
}
}
</script>
<%= form_tag(upload_school_path(@school.id),method: "post", multipart: true) do %>
<%#= text_field_tag 'school'%>
<div style="margin: 20px;">
<input type="hidden" value="<%= @school_name%>" name="school_name">
<%= image_tag(@school.logo_link, id: "avatar_image", :class=>"school_avatar")%>
<a type="button" onclick="$('#file').click();" style="margin: 90px 0 0 10px;float: left;padding: 2px 5px;border: 1px solid #eaeaea;cursor: pointer;text-decoration: none;width: 55px;">上传图片</a>
<%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>
<div style="clear: both;"></div>
<div style="margin-top: 10px;">
<%= submit_tag('上传') %>
<%= submit_tag('取消') %>
</div>
</div>
<% end %>

View File

@ -24,6 +24,7 @@
<div class="cl"></div>
</li>
<% if @is_teacher%>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
@ -58,16 +59,6 @@
</table>
<div class="cl"></div>
</li>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
</tbody>
</table>
<div class="cl"></div>
</li>
<% if @is_teacher%>
<!-- 编程作业老师才可以评分 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>

View File

@ -55,6 +55,7 @@
<% end%>
<% if @is_teacher%>
<div class="fr">
<% unless @homework.homework_type == 2%>
<% if @homework.student_works.empty?%>
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
@ -70,6 +71,7 @@
<span class="c_red">winrar</span>
工具进行解压
</div>
<% end%>
<%= link_to("匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%>
<%= link_to("缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%>
<%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
@ -137,6 +139,14 @@
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
输入
</td>
<td class="td_tit">
输出
</td>
</tr>
<% @homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
@ -149,9 +159,21 @@
<% end%>
</tbody>
</table>
<% end%>
<div class="cl"></div>
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 开发语言:</span>
<div class="fl">
<% if @homework.homework_detail_programing.language.to_i == 1%>
C
<% elsif @homework.homework_detail_programing.language.to_i == 2%>
C++
<% end%>
</div>
</div>
<div class="cl"></div>
<% end%>
<div class="mt5">
<% unless @homework.attachments.empty?%>
<span class="tit_fb" style="width: auto;"> 附件:</span>

View File

@ -29,49 +29,6 @@
<% end %>
<div id="RSide" class="fl">
<div class="message_box mb10">
<div nhname='new_message' style="display:none;">
<form action="<%= url_for(:controller => 'words', :action => 'create', :user_id => @user.id) %>" data-remote="true" method="post">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
<p nhname='contentmsg'></p>
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:3px;">取消</a>
<a id="new_message_submit_btn" href="javascript:void(0)" class="blue_n_btn fr mr5 " style="margin-top:3px;">留言</a>
</form>
</div>
<div class="cl"></div>
<div class="message_list_box" nhname="list_more_div" id="nh_messages" style="display:none;">
<div nhname="container" data-nodatamsg="暂无留言" data-pagesize="3" data-url="<%= url_for(:controller => 'users', :action => 'user_feedback4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
<div class="message_list_more" style="width:700px">
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr mr10">收起</a>
<div class="cl"></div>
</div>
</div>
</div>
<% if !@center_flag %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<div class="users_top">
<a href="<%=url_for(:controller => 'users', :action => 'user_courses')%>" class="f14 fb fl c_dark ml10 mt8"><%= @center_flag ? '我的课程' : 'TA的课程' %></a>
<% if @center_flag %>
<% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %>
<a href="<%= url_for(:controller => 'courses', :action => 'new',:host=>Setting.host_course) %>" class=" green_u_btn fr mt8 mr8" target="_blank">新建课程</a>
<% else %>
<a href="<%= join_private_courses_courses_path %>" data-remote ="true" class=" green_u_btn fr mt8 mr8">加入课程</a>
<% end %>
<% end %>
</div>
<div class="cl"></div>
<div nhname="container" data-nodatamsg="暂无课程" data-url="<%= url_for(:controller => 'users', :action => 'user_courses4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
<div class="cl"></div>
<div class="message_list_more mt10">
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<h4 class="users_h4">课程动态</h4>
@ -82,29 +39,6 @@
</div>
</div>
<% if !@center_flag %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<div class=" users_top">
<a href="<%=url_for(:controller => 'users', :action => 'user_projects')%>" class="f14 fb fl c_dark ml10 mt8"><%= @center_flag ? '我的项目' : 'TA的项目' %></a>
<% if @center_flag %>
<% if @user.allowed_to?(:add_project, nil, :global => true) %>
<a href="<%= url_for(:controller => 'projects', :action => 'new',:host=>Setting.host_name) %>" class=" green_u_btn fr mt8 mr8" target="_blank">新建项目</a>
<% else %>
<a href="<%= join_project_projects_path %>" data-remote ="true" class=" green_u_btn fr mt8 mr8">加入项目</a>
<% end %>
<% end %>
</div>
<div class="cl"></div>
<div nhname="container" data-nodatamsg="暂无项目" data-url="<%= url_for(:controller => 'users', :action => 'user_projects4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
<div class="cl"></div>
<div class="message_list_more mt10">
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<h4 class="users_h4">项目动态</h4>
<div nhname="container" data-nodatamsg="暂无动态" data-url="<%= url_for(:controller => 'users', :action => 'user_project_activities') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>

View File

@ -13,9 +13,9 @@
<div class="courses_top mb10">
<h2 class="courses_h2 fl">所有课程</h2>
<div class="courses_select fr">
<a href="<%= url_for(:controller => 'users', :action => 'user_courses')%>" class="select_btn <%= (@params['status']!='1' && @params['status']!='2') ? 'select_btn_select' : '' %> fl "> 全部</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :status=>'1')%>" class="select_btn <%= (@params['status']=='1') ? 'select_btn_select' : '' %> fl ">正在进行</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :status=>'2')%>" class="select_btn <%= (@params['status']=='2') ? 'select_btn_select' : '' %> fl "> 已经结束</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses')%>" class="select_btn <%= (@params!='1' && @params!='2') ? 'select_btn_select' : '' %> fl "> 全部</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :status=>'1')%>" class="select_btn <%= (@params=='1') ? 'select_btn_select' : '' %> fl ">正在进行</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :status=>'2')%>" class="select_btn <%= (@params=='2') ? 'select_btn_select' : '' %> fl "> 已经结束</a>
</div>
<div class="cl"></div>
</div>

View File

@ -13,9 +13,9 @@
<div class="courses_top mb10">
<h2 class="courses_h2 fl">全部项目</h2>
<div class="courses_select fr">
<a href="<%= url_for(:controller => 'users', :action => 'user_projects')%>" class="select_btn <%= (@params['status']!='1' && @params['status']!='2') ? 'select_btn_select' : '' %> fl "> 全部</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :status=>'1')%>" class="select_btn <%= (@params['status']=='1') ? 'select_btn_select' : '' %> fl ">我创建</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :status=>'2')%>" class="select_btn <%= (@params['status']=='2') ? 'select_btn_select' : '' %> fl "> 我参与</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_projects')%>" class="select_btn <%= (@params!='1' && @params!='2') ? 'select_btn_select' : '' %> fl "> 全部</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :status=>'1')%>" class="select_btn <%= (@params=='1') ? 'select_btn_select' : '' %> fl ">我创建</a>
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :status=>'2')%>" class="select_btn <%= (@params=='2') ? 'select_btn_select' : '' %> fl "> 我参与</a>
</div>
<div class="cl"></div>
</div>

View File

@ -56,21 +56,11 @@
<% end %>
</span>
<span class="font_welcome_trustie">
<!--
@course_page.title存储在first_page表中的title字段
原本代码
<%= @course_page.title %>
!-->
<%= l(:label_welcome_trustie_course) %>
</span>
<% else %>
<% unless @course_page.nil? %>
<span class="font_welcome_trustie">
<!--
@course_page.title存储在first_page表中的title字段
原本代码
<%= @course_page.title %>
!-->
<%= l(:label_welcome_trustie_course) %>
</span>
<span class="font_welcome_tdescription">,
@ -112,7 +102,6 @@
course_term = "春季学期"
end
%>
<%# (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %>
<% cur_school_course = @school_id.nil? ? [] : find_miracle_course(10,7,@school_id, year_now, course_term) %>
<% if cur_school_course.count == 0 %>

View File

@ -45,10 +45,10 @@
<% if @organization.nil? %>
<% unless @first_page.nil? %>
<!-- 改为国际化后无法通过后台配置
<%= @first_page.description.html_safe %>
<%#= @first_page.description.html_safe %>
-->
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie_project)%></span>,&nbsp;
<span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= l(:label_welcome_trustie_project_description)%></span></span>
<!--<span class="font_welcome_trustie"><%#= @first_page.title.html_safe %></span>,&nbsp;-->
<span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= @first_page.description.html_safe %></span></span>
<% end %>
<% else %>
<span class="font_welcome_school" style="color: #E8770D">

View File

@ -7,6 +7,7 @@ RedmineApp::Application.configure do
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
config.log_level =:debug
config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly
# Show full error reports and disable caching
config.consider_all_requests_local = true

View File

@ -350,7 +350,7 @@ zh:
label_input_email: 请输入邮箱地址
label_invite_trustie_user: "邀请Trustie注册用户"
label_invite_trustie_user_tips: "输入姓名、邮箱、昵称"
label_invite_trustie_user_tips: "支持姓名、邮箱、昵称搜索!"
label_user_role_null: 用户和角色不能留空!
label_invite_project: 邀请您加入项目
label_mail_invite_success: 您已成功加入项目!

View File

@ -381,6 +381,7 @@ zh:
label_organization_choose: --请选择组织--
label_organization_name: 组织名称
label_organization_list: 组织列表
label_school_plural: 学校列表
label_organization_new: 新建组织
label_organization_edit: 修改组织
label_project_plural: 项目列表
@ -669,6 +670,8 @@ zh:
label_tag: 标签
label_revision: 修订
label_revision_plural: 修订
lable_revision_code_count: 代码量
label_revision_commit_count: 提交次数
label_revision_id: 修订 %{value}
label_associated_revisions: 相关修订版本
label_added: 已添加
@ -715,6 +718,11 @@ zh:
label_commits_per_month: 每月提交次数
label_commits_per_author: 每用户提交次数
label_author_commits_per_month: 用户最近一月的提交次数
label_author_commits_six_month: 用户最近六个月提交次数
label_author_commits_year: 最近一年的提交次数
label_author_code_six_month: 用户最近六个月代码量
label_author_code_year: 用户最近一年代码量
label_view_diff: 查看差别
label_diff_inline: 直列
label_diff_side_by_side: 并排

View File

@ -39,6 +39,17 @@ RedmineApp::Application.routes.draw do
end
resources :school do
collection do
end
member do
get 'upload_logo'
post 'upload'
end
end
resources :homework_attach do
collection do
get 'get_homework_member_list'
@ -670,6 +681,7 @@ RedmineApp::Application.routes.draw do
match 'admin/test_email', :via => :get
match 'admin/default_configuration', :via => :post
get 'admin/organization'
get 'admin/schools'
resources :auth_sources do
member do
@ -808,9 +820,6 @@ RedmineApp::Application.routes.draw do
post 'school/search_school/', :to => 'school#search_school'
get 'school/search_school/', :to => 'school#search_school'
post 'school/upload', :to => 'school#upload'
get 'school/upload_logo', :to => 'school#upload_logo'
######added by nie
match 'tags/show_projects_tags'
########### added by liuping

View File

@ -454,6 +454,13 @@ ActiveRecord::Schema.define(:version => 20150722015428) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "documents", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.integer "category_id", :default => 0, :null => false
@ -737,6 +744,16 @@ ActiveRecord::Schema.define(:version => 20150722015428) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"
@ -854,7 +871,6 @@ ActiveRecord::Schema.define(:version => 20150722015428) do
t.datetime "created_on"
t.integer "comments_count", :default => 0, :null => false
t.integer "course_id"
t.datetime "updated_on"
end
add_index "news", ["author_id"], :name => "index_news_on_author_id"

View File

@ -369,6 +369,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural

View File

@ -380,6 +380,36 @@ module Redmine
nil
end
def parse_commit(commits)
sum = {file: 0, insertion: 0, deletion: 0}
commits.split("\n").each do |commit|
if /(\d+)\s+?file/ =~ commit
sum[:file] += $1 .to_i
end
if /(\d+)\s+?insertion/ =~ commit
sum[:insertion] += $1.to_i
end
if /(\d+)\s+?deletion/ =~ commit
sum[:deletion] += $1.to_i
end
end
sum[:insertion] + sum[:deletion]
end
def commits(authors, start_date, end_date, branch='master')
rs = []
authors.each do |author|
cmd_args = %W|log #{branch} --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}|
commits = ''
git_cmd(cmd_args) do |io|
commits = io.read
end
logger.info "git log output for #{author} #{commits}"
rs << {author: author, num: parse_commit(commits)}
end
rs
end
class Revision < Redmine::Scm::Adapters::Revision
# Returns the readable identifier
def format_identifier

View File

@ -5104,8 +5104,8 @@ KEditor.prototype = {
}
}
});
statusbar.removeClass('statusbar').addClass('ke-statusbar')
.append('<span class="ke-inline-block ke-statusbar-center-icon"></span>');
//statusbar.removeClass('statusbar').addClass('ke-statusbar')
// .append('<span class="ke-inline-block ke-statusbar-center-icon"></span>');
if (self._fullscreenResizeHandler) {
K(window).unbind('resize', self._fullscreenResizeHandler);
self._fullscreenResizeHandler = null;

View File

@ -2797,3 +2797,14 @@ div.repos_explain{
#activity .upload_img img{max-width: 580px;}
img,embed{max-width: 100%;}
img.school_avatar {
background: rgb(245, 245, 245);
padding: 4px;
border: 1px solid #e5dfc7;
float: left;
display: block;
width: 100px;
height: 100px;
max-width: none;
}

View File

@ -665,7 +665,6 @@ a:hover.ping_pic{border:1px solid #64bdd9;}
.ping_back_tit{ float:left; width:523px; margin-left:10px; }
a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;}
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.fr{ float:right;}
.min_search{ width:140px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; }
.li_min_search{ float:right; margin-right:-10px;}
.info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;}

View File

@ -28,7 +28,7 @@ a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
#polls div{word-break: break-all;word-wrap: break-word;}
.ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; }
.ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;}
.ur_title{ padding:20px 0px ; float:left; width:604px; }
.ur_title{ padding:20px 0px ; float:left; width:564px; }
.ur_required{ font-weight: bold; color:red;}
.ur_inputs{ color:#666;}
.ur_table{border-top:1px solid #dcdcdc; background:#fff;}
@ -101,10 +101,13 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
.ur_editor02{width:648px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;}
a.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; }
a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;}
a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px;}
a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;}
.ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;}
.ur_icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
a:hover.ur_icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
/***弹框***/
.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}

View File

@ -551,7 +551,24 @@ p.percent {
font-size: 12px;
}
.repositorytitle select{ width: 110px; height: 21px; }
.riviseRed {
width:15px;
height:15px;
margin-right: 3px;
background-color:#FF0000;
filter:alpha(opacity=50); /* ie 有效*/
-moz-opacity:0.5; /* Firefox 有效*/
opacity: 0.5; /* 通用,其他浏览器 有效*/
}
.changeBlue {
width:15px;
height:15px;
margin-right: 3px;
background-color:#0000FF;
filter:alpha(opacity=50); /* ie 有效*/
-moz-opacity:0.5; /* Firefox 有效*/
opacity: 0.5; /* 通用,其他浏览器 有效*/
}
/*导出*/