Merge branch 'szzh' into dev_hjq

This commit is contained in:
huang 2015-08-13 18:34:04 +08:00
commit deb3383ad9
139 changed files with 2492 additions and 1671 deletions

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

@ -39,9 +39,14 @@ class CoursesController < ApplicationController
else
@state = 5 #未登录
end
respond_to do |format|
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
end
# if @state == 1 || @state == 3
# respond_to course_path(course.id)
# else
respond_to do |format|
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
end
#end
rescue Exception => e
@state = 4 #已经加入了课程
respond_to do |format|
@ -119,47 +124,47 @@ class CoursesController < ApplicationController
@course_pages = Paginator.new @course_count, per_page_option, params['page']
# 课程的动态数
@course_activity_count=Hash.new
@courses_all.each do |course|
@course_activity_count[course.id]=0
end
case params[:course_sort_type]
when '0'
@courses = @courses_all.order("created_at desc")
@s_type = 0
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses,@course_activity_count
when '1'
@courses = @courses_all.order("course_ac_para desc")
@s_type = 1
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses,@course_activity_count
when '2'
@courses = @courses_all.order("watchers_count desc")
@s_type = 2
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses,@course_activity_count
when '3'
@course_activity_count=get_course_activity @courses_all,@course_activity_count_array
@courses=handle_course @courses_all,@course_activity_count
@s_type = 3
@courses = @courses[@course_pages.offset, @course_pages.per_page]
else
@s_type = 0
@courses = @courses_all.order("created_at desc")
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
@course_activity_count=get_course_activity @courses,@course_activity_count
end
# @course_activity_count=Hash.new
# @courses_all.each do |course|
# @course_activity_count[course.id]=0
# end
#
# case params[:course_sort_type]
# when '0'
# @courses = @courses_all.order("created_at desc")
# @s_type = 0
# @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#
# @course_activity_count=get_course_activity @courses,@course_activity_count
#
# when '1'
# @courses = @courses_all.order("course_ac_para desc")
# @s_type = 1
# @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#
# @course_activity_count=get_course_activity @courses,@course_activity_count
#
# when '2'
# @courses = @courses_all.order("watchers_count desc")
# @s_type = 2
# @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#
# @course_activity_count=get_course_activity @courses,@course_activity_count
#
# when '3'
# @course_activity_count=get_course_activity @courses_all,@course_activity_count_array
# @courses=handle_course @courses_all,@course_activity_count
# @s_type = 3
# @courses = @courses[@course_pages.offset, @course_pages.per_page]
#
# else
# @s_type = 0
# @courses = @courses_all.order("created_at desc")
# @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#
# @course_activity_count=get_course_activity @courses,@course_activity_count
#
# end
end
respond_to do |format|
@ -604,7 +609,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
@ -658,92 +663,9 @@ class CoursesController < ApplicationController
end
def show
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
return
end
@users_by_role = @course.users_by_role
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
end
@key = User.current.rss_key
#新增内容
@days = Setting.activity_days_default.to_i
if params[:from]
begin; @date_to = params[:from].to_date + 1; rescue; end
end
has = {
"show_course_files" => true,
"show_course_news" => true,
"show_course_messages" => true,
#"show_course_journals_for_messages" => true,
# "show_bids" => true,
# "show_homeworks" => true,
"show_polls" => true
}
@date_to ||= Date.today + 1
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
if @author.nil?
# 显示老师和助教的活动
# @authors = searchTeacherAndAssistant(@course)
@authors = course_all_member(@course)
events = []
key = "course_events_#{@course.id}".to_sym
if Rails.env.production? && Setting.course_cahce_enabled?
events = Rails.cache.read(key) || []
end
if events.empty?
@authors.each do |author|
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
:with_subprojects => false,
:author => author.user)
@activity.scope_select {|t| has["show_#{t}"]}
# modify by nwb
# 添加私密性判断
if User.current.member_of_course?(@course)|| User.current.admin?
events += @activity.events(@days, @course.created_at)
else
events += @activity.events(@days, @course.created_at, :is_public => 1)
end
end
Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled?
end
else
# @author = @course.teacher
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
:with_subprojects => false,
:author => @author)
@activity.scope_select {|t| has["show_#{t}"]}
# modify by nwb
# 添加私密性判断
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events(@days, @course.created_at)
else
events = @activity.events(@days, @course.created_at, :is_public => 1)
end
end
# 无新动态时,显示老动态
if events.count == 0
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events
else
events = @activity.events(:is_public => 1)
end
end
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
end
sorted_events = sort_activity_events_course(events)
events = paginateHelper sorted_events,10
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
# documents
course_activities = @course.course_activities.order("created_at desc")
@canShowRealName = User.current.member_of_course? @course
@course_activities = paginateHelper course_activities,10
respond_to do |format|
format.html{render :layout => 'base_courses'}
format.api

View File

@ -177,11 +177,11 @@ class FilesController < ApplicationController
def index
@flag = params[:flag] || false
#sort_init 'filename', 'asc'
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
# sort_init 'created_on', 'desc'
# sort_update 'created_on' => "#{Attachment.table_name}.created_on",
# 'filename' => "#{Attachment.table_name}.filename",
# 'size' => "#{Attachment.table_name}.filesize",
# 'downloads' => "#{Attachment.table_name}.downloads"
sort = ""
@sort = ""
@order = ""

View File

@ -1,6 +1,7 @@
class HomeworkCommonController < ApplicationController
require 'net/http'
require 'json'
require "base64"
layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create,:next_step]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
@ -22,7 +23,7 @@ class HomeworkCommonController < ApplicationController
#
# @homework = HomeworkCommon.new
# @homework.safe_attributes = params[:homework_common]
# @homework.late_penalty = 0
# @homework.late_penalty = 2
# @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @homework.publish_time = Time.now.strftime('%Y-%m-%d')
#
@ -30,7 +31,7 @@ class HomeworkCommonController < ApplicationController
# #匿评作业相关属性
# @homework_detail_manual = HomeworkDetailManual.new
# @homework_detail_manual.ta_proportion = 0.6
# @homework_detail_manual.absence_penalty = 0
# @homework_detail_manual.absence_penalty = 2
# @homework_detail_manual.evaluation_num = 3
# @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
# @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@ -40,9 +41,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
#新建作业下一步
@ -51,7 +52,7 @@ class HomeworkCommonController < ApplicationController
@homework = HomeworkCommon.new
@homework.safe_attributes = params[:homework_common]
@homework.late_penalty = 0
@homework.late_penalty = 2
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
@ -59,7 +60,7 @@ class HomeworkCommonController < ApplicationController
#匿评作业相关属性
@homework_detail_manual = HomeworkDetailManual.new
@homework_detail_manual.ta_proportion = 0.6
@homework_detail_manual.absence_penalty = 0
@homework_detail_manual.absence_penalty = 2
@homework_detail_manual.evaluation_num = 3
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@ -99,12 +100,14 @@ class HomeworkCommonController < ApplicationController
question = {title:homework.name,content:homework.description}
question[:input] = []
question[:output] = []
if params[:input] && params[:output]
if params[:input] && params[:output] && params[:result]
params[:input].each do |k,v|
if params[:output].include? k
homework_test = HomeworkTest.new
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
homework.homework_tests << homework_test
question[:input] << homework_test.input
question[:output] << homework_test.output
@ -221,17 +224,21 @@ class HomeworkCommonController < ApplicationController
homework_test = HomeworkTest.find id
homework_test.destroy if homework_test
end
if params[:input] && params[:output]
if params[:input] && params[:output] && params[:result]
params[:input].each do |k,v|
if params[:output].include? k
homework_test = HomeworkTest.find_by_id k
if homework_test #已存在的测试,修改
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
else #不存在的测试,增加
homework_test = HomeworkTest.new
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
homework_test.homework_common = @homework
end
homework_test.save
@ -351,6 +358,24 @@ class HomeworkCommonController < ApplicationController
end
end
def programing_test
test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
@index = params[:index]
uri = URI('http://192.168.80.21:8080/api/realtime.json')
body = test.to_json
res = Net::HTTP.new(uri.host, uri.port).start do |client|
request = Net::HTTP::Post.new(uri.path)
request.body = body
request["Content-Type"] = "application/json"
client.request(request)
end
result = JSON.parse(res.body)
@err_msg = result["compile_error_msg"]
result["results"].each do |re|
@result = re["status"]
end
end
private
#获取课程
def find_course

View File

@ -72,7 +72,7 @@ class NewsController < ApplicationController
@news_count = scope.count
@q = params[:subject]
if params[:subject].nil?
if params[:subject].nil? || params[:subject].blank?
scope_order = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC")
else

View File

@ -1,3 +1,4 @@
#encoding utf-8
class PollController < ApplicationController
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
before_filter :find_container, :only => [:new,:create, :index]
@ -137,11 +138,19 @@ class PollController < ApplicationController
@poll_questions.poll_answers.new question_option
end
end
if @poll_questions.save
respond_to do |format|
format.js
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
#修改题目
@ -328,6 +337,37 @@ class PollController < ApplicationController
end
end
def import_poll
@poll = Poll.find(params[:to_id])
question_num = @poll.poll_questions.select("max(question_number) question_number").first.question_number
import_poll = Poll.find(params[:import_id])
import_poll.poll_questions.each_with_index do |question,index|
option = {
:is_necessary => question.is_necessary,
:question_title => question.question_title,
:question_type => question.question_type,
:question_number => question_num + index+1
}
poll_questions = @poll.poll_questions.new option
for i in 1..question.poll_answers.count
answer = question.poll_answers[i-1][:answer_text]
question_option = {
:answer_position => i,
:answer_text => answer
}
poll_questions.poll_answers.new question_option
end
@poll.poll_questions << poll_questions
end
if @poll.save
@poll = Poll.find(params[:to_id])
respond_to do |format|
format.js
end
end
end
#重新发布问卷
def republish_poll
@poll.poll_questions.each do |poll_question|
@ -371,6 +411,70 @@ class PollController < ApplicationController
end
end
# 将其他地方的问卷导出来
def other_poll
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的问卷 进行导入
tea_ids = '('
tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')'
@polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
@polls_group_id = params[:polls_group_id]
respond_to do |format|
format.js
end
end
# 将问卷导入本课程
def import_other_poll
course_id = params[:course_id]
@course = Course.find(course_id)
params[:polls].each_with_index do |p,i|
poll = Poll.find(p)
option = {
:polls_name => poll.polls_name || l(:label_poll_new),
:polls_type => 'Course',
:polls_group_id => course_id,
:polls_status => 1,
:user_id => User.current.id,
:published_at => Time.now,
:closed_at => Time.now,
:show_result => 1,
:polls_description => poll.polls_description
}
@poll = Poll.create option
poll.poll_questions.each do | q|
#question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title]
option = {
:is_necessary => q[:is_necessary],
:question_title => q[:question_title],
:question_type => q[:question_type] || 1,
:question_number => q[:question_number]
}
@poll_questions = @poll.poll_questions.new option
for i in 1..q.poll_answers.count
answer = q.poll_answers[i-1].nil? ? l(:label_new_answer) : q.poll_answers[i-1][:answer_text]
question_option = {
:answer_position => i,
:answer_text => answer
}
@poll_questions.poll_answers.new question_option
end
end
@poll.save
end
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
else
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
end
@polls = paginateHelper polls,20 #分页
respond_to do |format|
format.js
end
end
private
def find_poll_and_course
@poll = Poll.find params[:id]

View File

@ -86,8 +86,14 @@ class ProjectsController < ApplicationController
@project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
else
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
end
@projects = @project_pages.order("created_on desc")
@limit = 10#per_page_option
@project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
@project_pages = Paginator.new @project_count, @limit, params['page']
respond_to do |format|
format.html {
render :layout => 'base'
@ -150,11 +156,15 @@ class ProjectsController < ApplicationController
end
def new
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
if User.current.login?
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
else
redirect_to signin_url
end
end
def share
@ -167,6 +177,10 @@ class ProjectsController < ApplicationController
end
def create
unless User.current.login?
redirect_to signin_url
return
end
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@ -280,11 +294,11 @@ class ProjectsController < ApplicationController
# 根据私密性,取出符合条件的所有数据
if User.current.member_of?(@project) || User.current.admin?
@events_pages = ForgeActivity.where("project_id = ?",@project).order("created_at desc").page(params['page'|| 1]).per(20);
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20);
#events = @activity.events(@date_from, @date_to)
else
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
= ?",@project,1).order("created_at desc")
= ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc")
.page(params['page'|| 1]).per(10);
# @events = @activity.events(@date_from, @date_to, :is_public => 1)
end
@ -361,37 +375,6 @@ class ProjectsController < ApplicationController
end
end
# dts测试工具
def dts_dep
render_403 unless User.current.admin?
@dts = Dts.all
end
# dts云部署
def yun_dep
render_403 unless User.current.admin?
end
# 软件知识库
def soft_knowledge
render_403 unless User.current.admin?
end
# 在线开发平台
def online_dev
render_403 unless User.current.admin?
end
# 软件资源库
def soft_file
render_403 unless User.current.admin?
end
# 软件服务
def soft_service
render_403 unless User.current.admin?
end
#发送邮件邀请新用户
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?

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
@ -463,8 +465,6 @@ update
data = graph_author_commits_per_month(@repository)
when "author_commits_six_month"
data = author_commits_six_month(@repository)
when "author_qoc_per_author"
data = graph_author_qoc_per_author(@repository)
when "author_code_six_months"
data = author_code_six_month(@repository)
end
@ -658,7 +658,7 @@ update
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_plural)
:title => l(:label_revision_commit_count)
)
graph.burn
end
@ -694,7 +694,7 @@ update
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_plural)
:title => l(:label_revision_commit_count)
)
graph.burn
end

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
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

@ -387,8 +387,8 @@ class StudentWorkController < ApplicationController
if stundet_work && params[:results] && params[:results].class.to_s == "Array"
homework_common = stundet_work.homework_common
params[:results].each do |result|
homework_test = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'").first
if homework_test
homework_tests = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'")
homework_tests.each do |homework_test|
student_work_test = StudentWorkTest.new
student_work_test.student_work = stundet_work
student_work_test.homework_test = homework_test

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.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc")
if(params[:status] == '1')
query = query.where("#{Project.table_name}.user_id = ?",@user.id);
projects = projects.where("projects.user_id = ?",@user.id)
elsif(params[:status] == '2')
query = query.where("#{Project.table_name}.user_id <> ?",@user.id);
projects = projects.where("projects.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,75 +243,35 @@ 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.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a 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
def user_newfeedback
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jours.update_all(:is_readed => true, :status => false)
@jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
if User.current == @user
jours.update_all(:is_readed => true, :status => false)
jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
end
end
#@limit = 10
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
@jour = paginateHelper @jours,10
@jour = paginateHelper jours,10
@state = false
render :layout=>'base_users_new'
end
# end
def user_comments
@ -482,95 +423,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 +481,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

@ -4,7 +4,7 @@ class WordsController < ApplicationController
include ApplicationHelper
before_filter :find_user, :only => [:new, :create, :destroy, :more, :back]
def create
if params[:new_form][:user_message].size>0
if params[:new_form][:user_message].size>0 && User.current.logged?
unless params[:user_id].nil?
if params[:reference_content]
message = params[:new_form][:user_message] + "\n" + params[:reference_content]
@ -18,22 +18,13 @@ class WordsController < ApplicationController
list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id)
end
@jour = list.last
# @user.count_new_jour
# if a_message.size > 5
# @message = a_message[-5, 5]
# else
# @message = a_message
# end
# @message_count = a_message.count
end
end
# @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse
# @jour = paginateHelper @jours,10
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jour = paginateHelper jours,10
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
format.js
#format.api { render_api_ok }
end
end
@ -93,7 +84,6 @@ class WordsController < ApplicationController
end
respond_to do |format|
format.js
#format.api { render_api_ok }
end
end
@ -206,7 +196,15 @@ class WordsController < ApplicationController
flash[:error] = feedback.errors.full_messages[0]
redirect_to project_feedback_url(params[:id])
end
end
#给用户留言
def leave_user_message
@user = User.find(params[:id])
if params[:new_form][:user_message].size>0 && User.current.logged? && @user
@user.add_jour(User.current, params[:new_form][:user_message])
end
redirect_to feedback_path(@user)
end
# add by nwb

View File

@ -1812,7 +1812,7 @@ module ApplicationHelper
#获取用户未过期的课程
def get_user_course user
courses_doing = []
user.courses.each do |course|
user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course|
if !course_endTime_timeout?(course)
courses_doing.push course
end
@ -2378,4 +2378,98 @@ module ApplicationHelper
end
notice.html_safe
end
#老师C语言的标准代码
def c_stantard_code_teacher
"// 老师您好这是一个C语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <stdio.h> //引用必须头文件
int main(int argc, char** argv) {
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
printf(\"%d\",a+b); //输出a+b
return 0;
}".html_safe
end
#老师C++语言的标准代码
def c_stantard_code_teacher_
"// 老师您好这是一个C++语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <iostream> //引用必须头文件
#include <cstdlib>
using namespace std;
int main(int argc, char** argv){
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
cout<<a+b; //a+b
return 0;
}".html_safe
end
#学生C语言的标准代码
def c_stantard_code_student
"// 同学好这是一个C语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <stdio.h> //引用必须头文件
int main(int argc, char** argv) {
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
printf(\"%d\",a+b); //输出a+b
return 0;
}".html_safe
end
#学生C++语言的标准代码
def c_stantard_code_student_
"// 同学好这是一个C++语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <iostream> //引用必须头文件
#include <cstdlib>
using namespace std;
int main(int argc, char** argv){
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
cout<<a+b; //a+b
return 0;
}".html_safe
end
end

View File

@ -676,4 +676,61 @@ module CoursesHelper
end
result
end
#生成课程相关动态的链接
def course_activity_link activity
# activity = CourseActivity.first
title = ""
url = ""
if activity.course_act
case activity.course_act_type
when "Course"
title = activity.course_act.name
url = course_path activity.course
when "HomeworkCommon"
title = "作业&nbsp;" + activity.course_act.name
url = student_work_index_path(:homework => activity.course_act.id)
when "News"
title = "通知公告&nbsp;" + activity.course_act.title
url = course_news_index_path(activity.course)
when "Attachment"
title = "课件&nbsp;" + activity.course_act.filename
url = course_files_path(activity.course)
when "Message"
title = "课程讨论区&nbsp;" + activity.course_act.subject
url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id)
when "JournalsForMessage"
title = "留言&nbsp;" + activity.course_act.notes
url = course_feedback_path(activity.course)
when "Poll"
title = "问卷&nbsp;" + activity.course_act.polls_name
url = poll_index_path(:polls_type => "Course", :polls_group_id => activity.course_id)
end
end
link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb"
end
#课程动态的描述
def course_activity_desc activity
desc = ""
if activity.course_act
case activity.course_act_type
when "Course"
desc = ""
when "HomeworkCommon"
desc = activity.course_act.description
when "News"
desc = activity.course_act.description
when "Attachment"
desc = ""
when "Message"
desc = activity.course_act.content
when "JournalsForMessage"
desc = ""
when "Poll"
desc = activity.course_act.polls_description
end
end
desc.html_safe
end
end

View File

@ -66,4 +66,31 @@ module HomeworkCommonHelper
link
end
#将状态转换为错误信息
def status_to_err_msg status
case status.to_i
when -1
'编译出错'
when -2
'输入和输出不匹配'
when -3
'输入和输出不匹配'
when 1
'运行出错'
when 2
'超时'
when 3
'内存超出'
when 4
'输出超出'
when 5
'禁用函数'
when 6
'其他错误'
when 0
'成功'
else
'未知错误'
end
end
end

View File

@ -74,4 +74,13 @@ module PollHelper
end
end
#带勾选框的问卷列表
def poll_check_box_tags(name,polls,current_poll)
s = ''
polls.each do |poll|
s << "<label>#{ check_box_tag name, poll.id, false, :id => nil } #{h poll.polls_name.blank? ? l(:label_poll_new) : poll.polls_name } [#{ h Course.find(poll.polls_group_id).name}]</label><br/>"
end
s.html_safe
end
end

View File

@ -321,6 +321,7 @@ module UsersHelper
list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all
return [count,list];
end
def get_visitor_users(obj)
query = Visitor.where("master_id=?",obj.id)
count = query.count
@ -332,46 +333,59 @@ module UsersHelper
end
def get_create_course_count(user)
if user == User.current
user.courses.count
else
user.courses.where("is_public = 1").count
end
user.courses.visible.where("tea_id = ?",user.id).count
end
#获取加入课程数
def get_join_course_count(user)
user.coursememberships.count - get_create_course_count(user)
user.courses.visible.count - get_create_course_count(user)
end
#发布作业数
def get_homework_commons_count(user)
HomeworkCommon.where("user_id = ?",user.id).count
end
#资源数
def get_projectandcourse_attachment_count(user)
Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count
end
#创建项目数
def get_create_project_count(user)
Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count
user.projects.visible.where("projects.user_id=#{user.id}").count
end
#加入项目数
def get_join_project_count(user)
user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user)
user.projects.visible.count - get_create_project_count(user)
end
#创建缺陷数
def get_create_issue_count(user)
Issue.where("author_id = ?",user.id).count
end
#解决缺陷数
def get_resolve_issue_count(user)
Issue.where("assigned_to_id = ? and status_id=3",user.id).count
end
#参与匿评数
def get_anonymous_evaluation_count(user)
StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count
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
@ -387,6 +401,7 @@ module UsersHelper
end
return str.html_safe
end
def get_activity_act_showname(activity)
case activity.act_type
when "HomeworkCommon"
@ -417,6 +432,7 @@ module UsersHelper
return activity.act_type
end
end
def get_activity_act_createtime(activity)
case activity.act_type
when "HomeworkCommon"
@ -427,6 +443,7 @@ module UsersHelper
return activity.act.created_on
end
end
def get_activity_container_url e
if !e.visible?
return "javascript:;"
@ -437,6 +454,7 @@ module UsersHelper
end
return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name)
end
def get_activity_url(activity,e)
if !e.visible?
return "javascript:;"
@ -465,6 +483,7 @@ module UsersHelper
return 'javascript:;'
end
end
def get_activity_opt(activity,e)
case activity.act_type
when "HomeworkCommon"
@ -474,14 +493,14 @@ module UsersHelper
when "Issue"
return '发表了问题'
when "Journal"
return '回复了问题'
return '更新了问题'
when "JournalsForMessage"
return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈'
#return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : ''
when "Message"
return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子'
when "Poll"
return '发布了问卷'
return '创建了问卷'
else
return '有了新动态'
end

View File

@ -27,6 +27,8 @@ class Attachment < ActiveRecord::Base
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
# 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end
include UserScoreHelper
@ -71,8 +73,8 @@ class Attachment < ActiveRecord::Base
cattr_accessor :thumbnails_storage_path
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score
before_save :files_to_final_location,:act_as_course_activity
after_create :office_conver, :be_user_score,:act_as_forge_activity
after_update :office_conver, :be_user_score
after_destroy :delete_from_disk,:down_user_score
@ -552,4 +554,10 @@ class Attachment < ActiveRecord::Base
end
end
#课程动态公共表记录
def act_as_course_activity
if self.container_type == "Course" && self.course_acts.empty?
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id)
end
end
end

View File

@ -33,6 +33,10 @@ class Course < ActiveRecord::Base
has_many :student_works, :through => :homework_commons, :dependent => :destroy
has_many :course_groups, :dependent => :destroy
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
has_many :course_activities
acts_as_taggable
acts_as_nested_set :order => 'name', :dependent => :destroy
@ -44,7 +48,7 @@ class Course < ActiveRecord::Base
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
validates_length_of :description, :maximum => 10000
before_save :self_validate
after_create :create_board_sync
after_create :create_board_sync, :act_as_course_activity
before_destroy :delete_all_members
safe_attributes 'extra',
@ -310,6 +314,11 @@ class Course < ActiveRecord::Base
end
end
#课程动态公共表记录
def act_as_course_activity
self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)
end
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
#def name
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)

View File

@ -0,0 +1,7 @@
class CourseActivity < ActiveRecord::Base
attr_accessible :user_id, :course_act_id,:course_act_type,:course_id
# 虚拟关联
belongs_to :course_act ,:polymorphic => true
belongs_to :course
belongs_to :user
end

View File

@ -13,17 +13,27 @@ class HomeworkCommon < ActiveRecord::Base
has_many :student_works, :dependent => :destroy
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
acts_as_attachable
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
after_create :act_as_activity, :send_mail
after_create :act_as_activity, :send_mail, :act_as_course_activity
after_destroy :delete_kindeditor_assets
def act_as_activity
self.acts << Activity.new(:user_id => self.user_id)
end
#课程动态公共表记录
def act_as_course_activity
if self.course
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id)
end
end
#删除对应的图片
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON

View File

@ -1,5 +1,5 @@
class HomeworkTest < ActiveRecord::Base
attr_accessible :input, :output, :homework_common_id
attr_accessible :input, :output, :homework_common_id,:result,:error_msg
belongs_to :homework_common
has_many :student_work_test

View File

@ -235,9 +235,10 @@ class Issue < ActiveRecord::Base
base_reload(*args)
end
def to_param
@to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize
end
# 之所以注释是以为最终以id形式显示另外如果项目名称带点号或者纯数字会出现问题
# def to_param
# @to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize
# end
# Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields
def available_custom_fields

View File

@ -56,9 +56,11 @@ class JournalsForMessage < ActiveRecord::Base
acts_as_attachable
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_activity #huang
after_create :act_as_activity, :act_as_course_activity
after_create :reset_counters!
after_destroy :reset_counters!
after_save :be_user_score
@ -177,4 +179,11 @@ class JournalsForMessage < ActiveRecord::Base
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,7
end
#课程动态公共表记录
def act_as_course_activity
if self.jour_type == 'Course'
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id)
end
end
end

View File

@ -388,7 +388,8 @@ class Mailer < ActionMailer::Base
@user = applied.user
recipients = @project.manager_recipients
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
@token = Token.get_token_from_user(@user, 'autologin')
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members', :token => @token.value)
mail :to => recipients,
:subject => s
end

View File

@ -32,6 +32,8 @@ class Message < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
@ -68,7 +70,7 @@ class Message < ActiveRecord::Base
after_update :update_messages_board
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets
after_create :act_as_activity,:be_user_score,:act_as_forge_activity, :send_mail
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :send_mail
#before_save :be_user_score
scope :visible, lambda {|*args|
@ -185,6 +187,13 @@ class Message < ActiveRecord::Base
:project_id => self.board.project.id)
end
end
#课程动态公共表记录
def act_as_course_activity
if self.course
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id)
end
end
#更新用户分数 -by zjc
def be_user_score

View File

@ -28,6 +28,8 @@ class News < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
@ -49,7 +51,7 @@ class News < ActiveRecord::Base
:author_key => :author_id
acts_as_watchable
after_create :act_as_activity,:act_as_forge_activity,:add_author_as_watcher, :send_mail
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:add_author_as_watcher, :send_mail
after_destroy :delete_kindeditor_assets
@ -121,6 +123,13 @@ class News < ActiveRecord::Base
end
end
#课程动态公共表记录
def act_as_course_activity
if self.course
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.course_id)
end
end
# Time 2015-03-31 13:50:54
# Author lizanle
# Description 删除news后删除对应的资源

View File

@ -8,7 +8,9 @@ class Poll < ActiveRecord::Base
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
# 添加课程的poll动态
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
after_create :act_as_activity
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
after_create :act_as_activity, :act_as_course_activity
acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" },
:description => :polls_description,
@ -27,4 +29,10 @@ class Poll < ActiveRecord::Base
self.acts << Activity.new(:user_id => self.user_id)
end
#课程动态公共表记录
def act_as_course_activity
if self.polls_type == "Course"
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id)
end
end
end

View File

@ -291,9 +291,10 @@ class User < Principal
name
end
## end
# 查询用户未读过的记录
def count_new_jour
count = self.new_jours.count
count = self.journals_for_messages.where("status=?", 1).count
end
#added by nie
@ -418,7 +419,7 @@ class User < Principal
end
def nickname(formatter = nil)
login
login.nil? || (login && login.empty?) ? "AnonymousUser" : login
end
def name(formatter = nil)

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

@ -17,6 +17,8 @@ if (window.Messenger) {
Messenger().post({
id: "label_apply_project_waiting",
message: "<%= l(:label_apply_project_waiting) %>",
showCloseButton: true,
showCloseButton: true
});
};
$("#applied_project_link_<%= @project.id%>").replaceWith("<%= escape_javascript(link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => @project.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{@project.id}") %>");

View File

@ -6,6 +6,7 @@
<% elsif @status == 2%>
alert("<%= l('project.join.tips.success') %>");
hideModal($("#popbox"));
$("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>");
<% elsif @status == 3%>
alert("<%= l('project.join.tips.has') %>");
<%else%>

View File

@ -29,32 +29,32 @@
<% is_float ||= false %>
<% for attachment in attachments %>
<div style="float:left;">
<p style="height:14px;line-height:12px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%>
<span title="<%= attachment.filename %>" id = "attachment_">
<p style="height:14px;line-height:12px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%>
<span title="<%= attachment.filename %>" id = "attachment_">
<% if options[:length] %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
<% else %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%>
<% end %>
</span>
<%if is_float%>
</div>
<% end%>
<%if is_float%>
</div>
<% end%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments',
:action => 'show',
:id => attachment,
:filename => attachment.filename%>
<% end %>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments',
:action => 'show',
:id => attachment,
:filename => attachment.filename%>
<% end %>
</div>
<div style="float:left;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="<%= attachment.description%>">
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
</div>
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
</div>
<span class="size">(
<%= number_to_human_size attachment.filesize %>)
</span>
@ -66,6 +66,16 @@
:class => 'delete delete-homework-icon',
:remote => true,
:title => l(:button_delete) %>
<% elsif attachment.container_type == 'Issue' %>
<% if User.current == attachment.author %>
<%= 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) %>
<% end %>
<% else %>
<%= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},
@ -89,13 +99,13 @@
</p>
<% end %>
<div class="thumbnails">
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<% images.each do |attachment| %>
<div class="pro_pic fl " width="100" height="73"><%= thumbnail_issue_tag(attachment) %></div>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>

View File

@ -61,8 +61,8 @@
<!--gcm-->
<p class="stats">
<%= content_tag('span', link_to("#{@course_activity_count[@course.id]}", course_path(@course)), :class => "info") %>
<%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %>
<%= content_tag('span', link_to("#{@course.course_activities.count}", course_path(@course)), :class => "info") %>
<%= content_tag('span', l(:label_x_activity, :count => @course.course_activities.count)) %>
</p>
<!--gcm-->

View File

@ -21,7 +21,7 @@
<img src="/images/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级" />
</a>
<% end%>
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('');$('#edit_group_<%= group.id %>').slideToggle();$('#new_group_name').hide();">
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('<%= group.name%>');$('#edit_group_<%= group.id %>').slideToggle();$('#new_group_name').hide();">
<img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" />
</a>
<% end %>
@ -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

@ -4,13 +4,16 @@
<% if @state %>
<% if @state == 0 %>
alert("加入成功");
hideModal($("#popbox"));
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%>"
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
<% elsif @state == 4 %>
alert("您加入的课程不存在");
<% elsif @state == 5 %>

View File

@ -1,83 +1,37 @@
<div class="project_r_h">
<% if @controller_name=='ActivityNotifys' %>
<a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2" style="width:100px;">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</h2>
<div class="fr mt10 mr5 c_grey02">
<a class="c_dblue">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</a>
</div>
<% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
<% if User.current.logged? %>
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</a>
<% end %>
<% end %>
</div>
<% if @events_by_day != nil && @events_by_day.size >0 %>
<% @events_by_day.keys.sort.reverse.each do |day| %>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="problem_main" nhname="container">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5 upload_img">
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %>
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
<span class="fl"> &nbsp;</span>
<span class="fl"> <%= l(:label_new_activity) %></span>
<%
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) :
(e.event_type.eql?("message") || e.event_type.eql?("reply") ?
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url))
%>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
<%end%>
<br />
<p class="mt5 break_word"><%= e.event_description.html_safe %>
<br />
<div class="cl"></div>
<%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p>
<%= link_to_attachments_course(e) if e.class.to_s == "News" %>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5">
<%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %>
<%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %>
<span class="fl"> <%= l(:label_user_create_project) %></span>
<%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5">
<br />
<%= l :label_create_time %> <%= format_time(@course.created_at) %>
</p>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<%@course_activities.each do |activity|%>
<div class="problem_main" nhname="container">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5 upload_img">
<%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %>
<span class="fl"> &nbsp;</span>
<span class="fl"> <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %></span>
<%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<!--span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span-->
<%#end%>
<%= link_to course_activity_link activity%>
<div class="cl"></div>
<p class="mt5 break_word">
<%= course_activity_desc activity%>
<br />
<div class="cl"></div>
<%= l :label_activity_time %> <%= format_time(activity.created_at) %>
</p>
<%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>

View File

@ -24,6 +24,8 @@ $('#upload_file_div').slideToggle('slow');
<% if @project %>
closeModal();
$("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
$("#project_files_count_info").html("<%= @all_attachments.count%>");
$("#project_files_count_nav").html("(<%= @all_attachments.count%>)")
// 添加文件上传成功提示
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');

View File

@ -56,7 +56,7 @@
<ul>
<li >
<label class="label02">&nbsp;开发语言:&nbsp;</label>
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %>
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
<div class="cl"></div>
</li>
@ -78,7 +78,7 @@
<li >
<label class="label02">&nbsp;标准代码:&nbsp;</label>
<textarea name="standard_code" class=" w547 h150 mb10 fl"><%= homework.homework_detail_programing.standard_code%></textarea>
<textarea name="standard_code" class=" w547 h400 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || c_stantard_code_teacher%></textarea>
<div class="cl"></div>
</li>
@ -87,16 +87,25 @@
<div>
<li>
<label class="label02">&nbsp;测试输入:&nbsp;</label>
<input type="text" class="fl h26 w200 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
<input type="text" class="fl h26 w190 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
</li>
<li >
<label class=" fl f14 ml10">&nbsp;输出:&nbsp;</label>
<input type="text" class="fl h26 w200 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
<input type="text" class="fl h26 w190 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
</li>
<li>
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
<!--span class="green_btn fl ml5 mt1">测试</span-->
<% if homework_test.result && !homework_test.result.to_s.empty?%>
<% if homework_test.result == 0%>
<a class="green_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">正确</a>
<% else%>
<a class="red_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">错误</a>
<% end%>
<% else%>
<a class="blue_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">测试</a>
<% end%>
<input type="hidden" id="test_result_<%= homework_test.id%>" name="result[<%= homework_test.id%>]" value="<%= homework_test.result%>"/>
</li>
<div class="cl"></div>
</div>
@ -105,19 +114,79 @@
<div>
<li>
<label class="label02">&nbsp;测试输入:&nbsp;</label>
<input type="text" class="fl h26 w200 mb10" name="input[0]" />
<input type="text" class="fl h26 w190 mb10" name="input[0]" value="1 2"/>
</li>
<li >
<label class=" fl f14 ml10">&nbsp;输出:&nbsp;</label>
<input type="text" class="fl h26 w200 mb10" name="output[0]" />
<input type="text" class="fl h26 w190 mb10" name="output[0]" value="3"/>
</li>
<li>
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
<!--span class="green_btn fl ml5 mt1">测试</span-->
<a class="blue_btn fl ml5 mt programing_test" onclick="programing_test('0')" id="test_send_0">测试</a>
<input type="hidden" id="test_result_0" name="result[0]" />
</li>
<div class="cl"></div>
</div>
<% end %>
<input type="hidden" name="error_msg" id="homework_test_error_msg" value="<%= homework.homework_tests.first.error_msg if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg%>">
<table class="border_ce" cellpadding="0" cellspacing="0" id="homework_work_test_show" style="display: <%= homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg && !homework.homework_tests.first.error_msg.empty? ? "block" : "none"%>">
<tbody>
<tr class="border_t" >
<td class="td_end fb c_red w60 td_board_left">
错误信息:
</td>
<td class="td_end wl" id="homework_work_test_desc">
<% if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg %>
<%= homework.homework_tests.first.error_msg%>
<% end%>
</td>
</tr>
</tbody>
</table>
</ul>
</div>
</div>
<script type="text/javascript">
//点击测试,发送
function programing_test(obj) {
$.post(
'<%= programing_test_homework_common_index_path%>',
{
src: $("textarea[name='standard_code']").val(),
input: $("input[name='input[" + obj +"]']").val(),
output: $("input[name='output[" + obj + "]']").val(),
language: $("select[name='language']").val(),
index: obj
},
function (data) {
}
);
}
function init_programing_test()
{
$(".programing_test").each(function(){
$(this).removeClass("green_btn red_btn").addClass("blue_btn").text("测试");
$(this).next("input").val("");
});
}
function homework_language_change(obj)
{
if(obj.val() == "1")
{
// alert(1);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher%>");
}
else if(obj.val() == "2")
{
// alert(2);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher_%>");
}
}
</script>

View File

@ -49,40 +49,54 @@
<div class="cl"></div>
<% 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|%>
<% if @is_teacher%>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
<%=test.input%>
输入
</td>
<td class="td_tit">
<%= test.output%>
输出
</td>
</tr>
<% end%>
</tbody>
</table>
<% end%>
<div class="cl"></div>
<% homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
<%=test.input%>
</td>
<td class="td_tit">
<%= test.output%>
</td>
</tr>
<% end%>
</tbody>
</table>
<div class="cl"></div>
<% end%>
<div class="mt5">
<% unless homework.attachments.empty?%>
<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>
</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

@ -0,0 +1,12 @@
$("#test_send_<%= @index%>").replaceWith("<a class='<%= @result == 0 ? 'green_btn' : 'red_btn'%> fl ml5 mt1 programing_test' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%></a>");
$("#test_result_<%= @index%>").val("<%= @result%>");
<% if @err_msg || @result != 0%>
$("#homework_work_test_show").show();
$("#homework_work_test_desc").text("<%= escape_javascript(@err_msg || status_to_err_msg(@result))%>");
<% if @err_msg%>
$("#homework_test_error_msg").val("<%= escape_javascript(@err_msg)%>");
<% end%>
<% else%>
$("#homework_work_test_show").hide();
$("#homework_test_error_msg").val("");
<% end%>

View File

@ -6,7 +6,7 @@
<div class="pro_page_box">
<div class="pro_page_top break_word">
<%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %>
<a href="javascript:void(0)"><%= "#" + @issue.project_index %></a>
<a href="javascript:void(0)"><%= "#" + @issue.id.to_s %></a>
</div>
<div class="problem_main">
<div class="ping_dispic">

View File

@ -0,0 +1,46 @@
<div id="Footer">
<div class="footerAboutContainer">
<ul class="footerAbout">
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="http://forge.trustie.net/projects/2/feedback" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_recruitment_information)%></a>|</li>
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
<select class="languageBox">
<option value="Chinese" selected="selected">中文</option>
<option value="English">英文</option>
</select>
</li>
</ul>
</div>
<div class="cl"></div>
<ul class="departments">
<li class="fl mr10">
<strong><%= l(:label_hosted_organization)%></strong><a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47" class=" ml10 f_grey" target="_blank"><%= l(:label_hosted_by)%></a>
</li>
<li class="fl">
<a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="mr45 f_grey" target="_blank"><%= l(:label_sponsor)%></a>
</li>
<li class="fl mr10">
<strong><%= l(:label_partners)%></strong><a href="http://eecs.pku.edu.cn" class="ml10 f_grey" target="_blank"><%= l(:label_co_organizer_EECS)%></a>
</li>
<li class="fl">
<a href="http://scse.buaa.edu.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_BHU)%></a>
</li>
<li class="fl">
<a href="http://www.iscas.ac.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_CAS)%></a>
</li>
<li class="fl">
<a href="http://www.inforbus.com/" class="f_grey" target="_blank"><%= l(:label_co_organizer_InforS)%></a>
</li>
</ul>
<div class="cl"></div>
<ul class="copyright">
<li class="fl"><%= l(:label_rights_reserved)%></li>
<span class="fl mw15">|</span>
<li class="fl"><a href="http://www.miibeian.gov.cn/" class="fl f_grey" target="_blank"><%= l(:label_license)%></a></li>
</ul>
</div><!--Footer end-->
<div class="cl"></div>

View File

@ -18,7 +18,7 @@
<ul class="sub_menu">
<% if @show_course == 1 && !visiable %>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% hasCourse=true %>
<% break %>
@ -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 => 'user_newfeedback', id: User.current.id, host: Setting.host_user},
{:class => 'my-message'} if User.current.logged?%>
</li>
</ul>

View File

@ -26,7 +26,7 @@
<li>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
<ul>
<% User.current.courses.each do |course| %>
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
<% end %>
@ -41,8 +41,12 @@
<li>
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
<ul>
<% User.current.projects.each do |project| %>
<li title="<%=project.name%>"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>"><%=project.name%></a></li>
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
<li title="<%=project.name%>">
<a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>">
<%=project.name%>
</a>
</li>
<% end %>
</ul>
</li>

View File

@ -26,7 +26,7 @@
<li id="my_courses_li">
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
<ul id="my_courses_ul">
<% user_course.reverse.each do |course| %>
<% user_course.each do |course| %>
<li title="<%=course.name%>">
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
</li>
@ -40,7 +40,7 @@
<li id="my_projects_li">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
<ul id="my_projects_ul" >
<% User.current.projects.reverse.each do |project| %>
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
<li title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
</li>

View File

@ -4,7 +4,7 @@
<ul class="course_sub_menu">
<% course_index = 0 %>
<% User.current.courses.reverse.each do |course| %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %>
<% course_index += 1 %>

View File

@ -2,7 +2,7 @@
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
<% User.current.projects.reverse.each do |project| %>
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
</li>

View File

@ -1,8 +1,11 @@
<% if(User.current.logged? && User.current!=target)%>
<%if(target.watched_by?(User.current))%>
<a id="user_watch_id" href="<%= watch_path(:object_type=>
'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
<% else %>
<a id="user_watch_id" href="<%= watch_path(:object_type=>'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr gz_btn mr10" data-method="post" data-remote="true" title="添加关注">关注</a>
<% end %>
<% if User.current.logged?%>
<% if User.current == target%>
<a href="<%= url_for(:controller => 'my', :action => 'account') %>" class="fr gz_btn mr10 ">编辑资料</a>
<%else%>
<%if(target.watched_by?(User.current))%>
<a id="user_watch_id" href="<%= watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
<% else %>
<a id="user_watch_id" href="<%= watch_path(:object_type=>'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr gz_btn mr10" data-method="post" data-remote="true" title="添加关注">添加关注</a>
<% end %>
<% end%>
<% end %>

View File

@ -1,5 +1,5 @@
<% watcher_count,watcher_list = get_watcher_users(user) %>
<div id="watcher_nav_list" class="leftbox mt10" style="display:<%= watcher_count==0 ? 'none' : 'block' %>">
<div id="watcher_nav_list" class="leftbox" style="display:<%= watcher_count==0 ? 'none' : 'block' %>">
<h4 class="fl">关注</h4><a href="<%=url_for(:controller => 'users', :action => 'user_watchlist', :id=>user.id)%>" data-count="<%= watcher_count %>" style="display:<%= watcher_count>10 ? 'block' : 'block' %>" class="more fr mr10">更多</a>
<div class="cl"></div>
<div class="mt5">

View File

@ -113,7 +113,7 @@
<div class="subNav">
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
<!--暂时不显示课程动态数,优化后在显示-->
<%= link_to "(#{course_activity_count @course})", course_path(@course), :class => "subnav_num c_orange"%>
<%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
</div>
<div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>

View File

@ -100,7 +100,7 @@
<span>|&nbsp;</span>
<%= l(:project_module_attachments) %>
<% attaments_num %>
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %></span>
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue', :id=>'project_files_count_info' %></span>
<% end %>
</div>
<div class="cl"></div>

View File

@ -17,6 +17,7 @@
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','users', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "avatars"%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
@ -69,7 +70,7 @@
<% end %>
</div><!--uers_info end-->
<div class="leftbox mt10">
<div class="leftbox">
<ul class="leftbox_ul_left">
<li>最近登录&nbsp;:</li> <!--加入时间修改为最近登录 -->
<% if @user.user_extensions!=nil && @user.user_extensions.identity == 2 %>
@ -126,40 +127,62 @@
<div class="cl"></div>
</div>
<div class="subNavBox ">
<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="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 => '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>
<% 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 ">
<%= link_to "留言",feedback_path(@user),:class => "f14 c_blue02"%>
</div>
</div><!--侧导航 end-->
<% 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 %>
<% if @user.user_extensions && @user.user_extensions.identity == 0 %>
<% if(get_create_course_count(@user)) != 0 %>
<li>创建课程&nbsp;:</li>
<% end %>
<% if(get_homework_commons_count(@user)) == 0 %>
<% 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 %>
<% if @user.user_extensions.identity == 1 %>
<li>参加匿评&nbsp;:</li>
<% end %>
<% if (get_projectandcourse_attachment_count(@user) != 0) %>
@ -179,18 +202,18 @@
<% 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 %>
<% if @user.user_extensions && @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 %>
<% 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 %>
<% if @user.user_extensions.identity == 1 %>
<li><%= get_anonymous_evaluation_count(@user) %></li>
<% end %>
<% if (get_projectandcourse_attachment_count(@user) != 0) %>
@ -212,13 +235,24 @@
<div class="cl"></div>
</div>
<div class="cl"></div>
<!--<div class="cl"></div>-->
<!-- tag模块 -->
<div class="project_Label">
<h4 class="mb5"><%= l(:label_tag)%>:</h4>
<div class="tag_h">
<div id="tags">
<%= render :partial => 'tags/user_tag', :locals => {:obj => @user,:object_flag => "1"}%>
</div>
</div>
<div class="cl"></div>
</div><!--项目标签 end-->
<%= render :partial => 'layouts/user_watch_list', :locals => {:user => @user} %>
<%= render :partial => 'layouts/user_fans_list', :locals => {:user => @user} %>
<% visitor_count,visitor_list = get_visitor_users(@user) %>
<% if(User.current.admin?) %>
<div class="leftbox mt10" style="display:<%= visitor_count==0 ? 'none' : 'block' %>">
<div class="leftbox" style="display:<%= visitor_count==0 ? 'none' : 'block' %>">
<h4 class="fl">访客</h4><a href="<%=url_for(:controller => 'users', :action => 'user_visitorlist', :id=>@user.id)%>" data-count="<%= visitor_count %>" style="display:<%= visitor_count>10 ? 'block' : 'block' %>" class="more fr mr10">更多</a>
<div class="cl"></div>
<div class="mt5">
@ -244,7 +278,9 @@
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-modal" style="display:none;"></div>
<%= javascript_include_tag '/javascripts/avatars.js' %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<div>
<div><a href="javascript:hideModal();" class="box_close"></a></div>
@ -291,5 +327,17 @@
</div><!--floatbox end-->
</div>
<script type="text/javascript">
$(function(){
if($(".top_new").length==0){
$("#RSide").css("min-height",$("#LSide").height()-30);
}
else{
$("#RSide").css("min-height",$("#LSide").height()-87);
}
});
</script>
</body>
</html>

View File

@ -81,7 +81,7 @@
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_course_homework) %></span>
<%= link_to truncate(bid.name.html_safe,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value),
<%= link_to truncate(bid.name.html_safe,length: 30,omission: '...'), student_work_index_url(:homework => bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
@ -225,10 +225,10 @@
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_issue_update) %></span>
<% if issues_journal.notes.blank? || issues_journal.notes.nil? %>
<%= link_to truncate(l(:label_isuue_mail_status),length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value),
<%= link_to truncate(issues_journal.issue.subject.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value),
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<% else %>
<%= link_to truncate(issues_journal.notes.html_safe,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value),
<%= link_to truncate(issues_journal.notes.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value),
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<% end %>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(issues_journal.created_on) %></span>

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

@ -0,0 +1,37 @@
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
<div class="upload_con">
<h2>选择问卷导入本课程</h2>
<div class="upload_box">
<div id="error_show" style="color: red;"></div>
<%= form_tag import_other_poll_poll_index_path,
method: :post,
remote: true,
id: "relation_file_form" do %>
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导&nbsp;&nbsp;入</a>
<a href="javascript:void(0)" class="blue_btn grey_btn fl c_white " onclick="closeModal();">取&nbsp;&nbsp;消</a>
<% end -%>
</div>
</div>
</div>
<script>
function submit_quote() {
$('#error_show').html('');
var selected = false;
for(var i = 0; i < $("input[name='polls[]']").length;i++){
if($("input[name='polls[]']")[i].checked){
selected = true;
}
}
if (selected){
$('#submit_quote').parent().submit();
closeModal();
}else{
$('#error_show').html('您没有选择任何问卷');
}
}
</script>

View File

@ -41,6 +41,7 @@
<li class="polls_de_grey fr ml5">导出</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%></li>
<% end%>

View File

@ -2,27 +2,262 @@
<script type="text/javascript">
//编辑问卷描述之后
var popWindow ; //弹出框的引用
var importPollPopWindow; //选择导入的弹出框引用
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');
}
if(importPollPopWindow && e.target.nodeName != 'A' && !importPollPopWindow.is(e.target) && importPollPopWindow.has(e.target).length === 0){
importPollPopWindow.css('display', 'none');
}
});
})
function add_MC(){
function dismiss(quest_type,quest_id){
popWindow = $("#div_"+quest_type+"_"+quest_id);
if(popWindow){
popWindow.css('display', 'none');
}
}
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 importPoll(){
importPollPopWindow = $("#import_poll");
$("#import_poll").css("position", "absolute");
$("#import_poll").css("top", $("#import_btn").offset().top+30);
$("#import_poll").css("left", $("#import_btn").offset().left-65);
$("#import_poll").css("display","block")
}
function remote_import(){
importPollPopWindow.css('display', 'none');
if($("#import_poll").val() === 0){
return;
}else{
if(confirm("确认导入问卷"+$("#import_poll").find("option:selected").text()+"?")){
$("#import_form").submit();
}else{
return;
}
}
}
//添加标题时确定按钮
function add_poll_question(doc)
{
@ -147,5 +382,16 @@ function edit_head(){
</div>
</div>
<div class="cl"></div>
<!-- 新增问题 -->
<div id="import_poll" style="display: none">
<%= form_tag({:controller => 'poll', :action => 'import_poll', :to_id => @poll.id},:remote=>'true', :method => :get,:id=>"import_form") do %>
<%= select( :poll, :id, Poll.where("polls_group_id = #{@poll.polls_group_id} and polls_type='course' and id != #{@poll.id}").map{|c| [c.polls_name, c.id]}.unshift(["选择要导入的问卷",0]),
{ :include_blank => false,:selected=> 0,:class=>"w90"
},
{:onchange=>"remote_import();",:id=>"import_id",:name=>"import_id"}
)
%>
<% end%>
</select>
</div>
</div><!--编辑end-->

View File

@ -3,20 +3,14 @@
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%= link_to "导入", other_poll_poll_index_path(:polls_group_id => @course.id), :remote=>true,:class => "newbtn"%>
<%= link_to l(:label_new_poll), new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => "newbtn" %>
<% end%>
</div>
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>" class="polls_list_ul">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
</ul>
<div class="cl"></div>
<% end%>
<div id="polls_list" class="polls_list">
<%= render :partial => 'polls_list', :locals => {:polls => @polls,:obj_pages=>@obj_pages,:obj_count=>@obj_count} %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div><!--列表end-->

View File

@ -0,0 +1,10 @@
<% polls.each do |poll|%>
<ul id="polls_<%= poll.id %>" class="polls_list_ul">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
</ul>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full obj_pages, obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>

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" >
@ -29,4 +34,15 @@
</tbody>
</table>
</div>
</div><!--单选题显示 end-->
</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=" dismiss('mc',<%=poll_question.id%>);insert_MC('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_MCQ('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_SINGLE('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('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">
@ -29,4 +30,15 @@
</tbody>
</table>
</div>
</div><!--多选题显示 end-->
</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=" dismiss('mcq',<%=poll_question.id%>);insert_MC('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MCQ('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_SINGLE('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MULIT('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,5 +1,8 @@
<div class="ur_page_head ur_editor02" ><!--头部显示 start-->
<a href="javascript:" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
<h1 class="ur_page_title" id="polls_name_h"><%= poll.polls_name%></h1>
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
<div class="cl"></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><!--多行展示 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=" dismiss('mulit',<%=poll_question.id%>);insert_MC('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MCQ('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_SINGLE('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('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><!--单行文字展示 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=" dismiss('single',<%=poll_question.id%>);insert_MC('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_MCQ('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('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

@ -0,0 +1 @@
$('#polls_list').html('<%= escape_javascript(render :partial => 'polls_list', :locals => {:polls => @polls,:obj_pages=>@obj_pages,:obj_count=>@obj_count}) %> <div class="cl"></div>');

View File

@ -0,0 +1,4 @@
/**
* Created by lizanle on 2015/7/29.
*/
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');

View File

@ -80,6 +80,11 @@
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
</script>
<div class="polls_content02" id="polls">
<%= render :partial => 'poll_list'%>

View File

@ -0,0 +1,13 @@
<% if @polls.empty? %>
alert('您目前还没有自己新建的问卷');
<% else %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
<% end %>

View File

@ -31,7 +31,7 @@
<div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %>
<a class="subnav_num">(<%= attaments_num %>)</a>
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>

View File

@ -19,7 +19,7 @@
<div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %>
<a class="subnav_num">(<%= attaments_num %>)</a>
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>

View File

@ -1,15 +1,15 @@
<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;}
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;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<div class="msg_box" id='leave-message' nhname='new_message' style="height:auto;">
@ -22,18 +22,18 @@
<hr/>
</div>
<% else %>
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%>
<%= f.text_area 'project_message', :rows => 3, :cols => 65,
:placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %>
<p nhname="contentmsg"></p>
<div class="fl mt10" style="padding-top:5px;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %>
<% end %>
<%= form_for('new_form', :method => :post, :html => {:id => 'project_feedback_form', :multipart => true},
:url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%>
<%= f.text_area 'project_message', :rows => 3, :cols => 65,
:placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %>
<p nhname="contentmsg"></p>
<div class="fl mt10" style="padding-top:5px;" nhname="toolbar_container"></div>
<%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %>
<%= link_to l(:button_leave_meassge), "javascript:void(0)", :onclick => 'submitProjectFeedback();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fr mt10 mb10' %>
<% end %>
<% end %>
<div class="cl"></div>
<div class="cl"></div>
</div>
<div id="history">
<%= render :partial => 'history',:locals => { :journals => @jour, :state => false} %>
@ -42,47 +42,47 @@
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
$(function(){
function init_editor(params){
params.textarea.removeAttr('placeholder');
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
function init_editor(params){
params.textarea.removeAttr('placeholder');
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
return editor;
}
}).loadPlugin('paste');
return editor;
}
function nh_check_field(params){
var result=true;
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
function nh_check_field(params){
var result=true;
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();
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;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
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 init_form(params){
function init_form(params){
// var flag = false;
// if(params.form.attr('data-remote') != undefined ){
// flag = true
@ -108,93 +108,93 @@
// return false;
// }
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
// return true; //这个涛哥的firefox不能提交
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
}
return false;
});
}
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
}
return false;
});
}
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
}
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// $("#nhjump").attr('href','#'+params.div_form.attr('id'));
// $("#nhjump")[0].click();
}
},300);
params.textarea.data('init',1);
});
}
},300);
params.textarea.data('init',1);
});
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
// $("a[nhname='cancel_btn']",params.div_form).click(function(){
// nh_reset_form(params);
// });
params.textarea.data('init',1);
}
});
params.textarea.data('init',1);
}
});
});
});
});
</script>

View File

@ -30,7 +30,7 @@
<div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %>
<a class="subnav_num">(<%= attaments_num %>)</a>
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>

View File

@ -36,74 +36,6 @@
<%= link_to l(:label_project_tool_response) ,project_feedback_path(@project)%>
</li>
<li>
<% if User.current.admin? %>
<%= link_to l(:label_project_dts_yun) ,yun_dep_project_path(@project), data: { confirm:'你确定要对本项目进行云化部署吗?' } %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS评估工具</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS证据采集工具</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS证据评估统计分析工具</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<%= link_to "代码缺陷测试工具(DTS)" ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.seforge.org/sase/" target="_Blank">软工服务平台(SASSP)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://tsr.sei.pku.edu.cn/home.action" target="_Blank">软件知识库(KnowledgeBase)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">可信评估工具(Evaluator)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">在线验证工具(BACH-Online)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">软件测试工具(SSCC-Web)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.service4all.org.cn/servicexchange/" target="_Blank">服务资源共享平台(ServiceXchange)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.service4all.org.cn/repository/ServiceCloud/MyServiceContainer.jsp" target="_Blank">在线服务开发平台(ServiceFoundry)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.service4all.org.cn" target="_Blank">组合开发和运行演化平台(Service4All)</a>
<% end %>
</li>

View File

@ -1,77 +0,0 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_dts_new) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#font_color{background:yellow;text-align:center;color:white;}
td.redBox {border:1px solid #b0b0b0; width:80px; background-color:#EAEAEA; }
td.redBox2 {border:1px solid #b0b0b0; width:120px; }
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 100px;padding-bottom: 10px;font-size: 14px;">代码上传分析中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">1%</div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",70);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="fr f14 " style="padding-right: 32px;padding-bottom: 10px;">语言:<span style="color: red">Java</span> 总文件数:<span style="color: red">361</span> 代码行数:<span style="color: red">48662</span></p>
<% @dts.each do |dt| %>
<div style="padding-left: 35px;padding-top: 10px;">
<table width="600" border="0" style="padding-left: 30px;padding-top: 100px; border-spacing:0; border-collapse:collapse; border: 1px solid #b0b0b0;">
<tr>
<td align="center" class="redBox">错误变量</td>
<td class="redBox2"> &nbsp;<%= dt.Variable %></td>
<td align="center" class="redBox">起始行</td>
<td class="redBox2"> &nbsp;<%= dt.StartLine %></td>
<td align="center" class="redBox">IP行</td>
<td class="redBox2"> &nbsp;<%= dt.IPLine %></td>
</tr>
<tr>
<td align="center" class="redBox">缺陷代码</td>
<td colspan="5" class="redBox2"> &nbsp;<%= dt.IPLineCode %></td>
</tr>
<tr>
<td align="center" class="redBox">错误描述</td>
<td colspan="5" class="redBox2">&nbsp;<%= dt.Description %></td>
</tr>
<tr>
<td align="center" class="redBox">文件</td>
<td colspan="5" class="redBox2"> &nbsp;<%= dt.File %></td>
</tr>
</table>
</div>
<% end %>
</div>

View File

@ -1,3 +0,0 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_project_dts) %></h2>
</div>

View File

@ -104,9 +104,13 @@
</div>
<% end %>
<div class="pagination">
<ul>
<%= pagination_links_full @project_pages, @project_count %>
</ul>
</div>
<%= paginate @project_pages %>
<%#= paginate @project_pages %>

View File

@ -13,8 +13,8 @@
<td class="w90" > <%= l(:field_effective_date) %></td>
<td class="w150"><%= l(:field_description) %> </td>
<td class="w90"><%= l(:field_status) %></td>
<td class="w90"><%= l(:field_sharing) %></td>
<td class="w150"><%= l(:label_wiki_page) %></td>
<!--<td class="w90"><%#= l(:field_sharing) %></td>-->
<!--<td class="w150"><%#= l(:label_wiki_page) %></td>-->
<td class="w150"></td>
</tr>
<% for version in @project.shared_versions.sort %>
@ -25,13 +25,13 @@
<td class="description"><%= format_date(version.effective_date) %></td>
<td class="description tl" style="word-break:break-all;"><%=h version.description %></td>
<td class="status"><%= l("version_status_#{version.status}") %></td>
<td class="sharing"><%=h format_version_sharing(version.sharing) %></td>
<td class="tl" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="">
<%= link_to_if_authorized(h(truncate(version.wiki_page_title,:length=>20)), {:controller => 'wiki',
:action => 'show',
:project_id => version.project,
<!--<td class="sharing"><%#=h format_version_sharing(version.sharing) %></td>-->
<!--<td class="tl" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="">-->
<%#= link_to_if_authorized(h(truncate(version.wiki_page_title,:length=>20)), {:controller => 'wiki',
# :action => 'show',
# :project_id => version.project,
:id => Wiki.titleize(version.wiki_page_title)},:class=>"c_blue02") || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %>
</td>
<!--</td>-->
<td >
<% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %>
<%= link_to l(:button_edit), edit_version_path(version), :class => 'c_purple' %></a>
@ -68,20 +68,20 @@
<label class="label02"><%=l(:field_status)%></label>
<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %>
</li>
<li >
<label class="label02"><%=l(:label_wiki_page)%></label>
<%= f.text_field :wiki_page_title, :size =>60, :label => :label_wiki_page, :disabled => @project.wiki.nil? %>
</li>
<!--<li >-->
<!--<label class="label02"><%#=l(:label_wiki_page)%></label>-->
<!--<%#= f.text_field :wiki_page_title, :size =>60, :label => :label_wiki_page, :disabled => @project.wiki.nil? %>-->
<!--</li>-->
<li >
<label class="label02"><%=l(:label_date)%></label>
<%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>" fl" %>
<%= calendar_for('version_effective_date') %>
</li>
<div class="cl mb10"></div>
<li >
<label class="label02"><%=l(:field_sharing)%></label>
<%= f.select :sharing, @project.versions.build.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %>
</li>
<!--<li >-->
<!--<label class="label02"><%#=l(:field_sharing)%></label>-->
<!--<%#= f.select :sharing, @project.versions.build.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %>-->
<!--</li>-->
<a href="#" onclick="$('#new_project_version_form').submit();" class="blue_btn ml110"><%=l(:button_save)%></a>
</ul>

View File

@ -93,21 +93,7 @@
</div>
<div class="cl"></div>
</div>
<!--Document-->
<% elsif e.forge_act_type == "Document" %>
<div class="problem_main">
<a class="problem_pic fl"><%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %></a>
<div class="problem_txt fl mt5 break_word">
<a class="problem_name fl ">
<%= h(e.project) if @project.nil? || @project.id != e.project_id %>
<%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %></a><span class="fl"> <%= l(:label_new_activity) %> </span>
<%= link_to format_activity_title("#{l(:label_document)}: #{act.title}"), {:controller => 'documents', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %><br />
<p class="mt5 break_word"><%= textAreailizable act,:description %><br />
<%= l :label_create_time %> <%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
</div>
<div class="cl"></div>
</div>
<!--Attachment -->
<% elsif e.forge_act_type == "Attachment" %>
<div class="problem_main">

View File

@ -1,46 +0,0 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_soft_file) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 100px;padding-bottom: 10px;font-size: 14px;">软件资源库部署中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",30);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="pl10 f14 "><a href="http://rubyblog.forge.trustie.net/myblog">云化部署工具部署完后的网址</a></p>
</div>

View File

@ -1,46 +0,0 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_soft_knowledge) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#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>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",30);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="pl10 f14 "><a href="http://rubyblog.forge.trustie.net/myblog">云化部署工具部署完后的网址</a></p>
</div>

View File

@ -1,46 +0,0 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_soft_service) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#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>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",30);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="pl10 f14 "><a href="http://rubyblog.forge.trustie.net/myblog">云化部署工具部署完后的网址</a></p>
</div>

View File

@ -1,47 +0,0 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_dts_yun) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<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()",60);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width="";
document.getElementById("in").innerHTML="";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px; ">
<p class="pl10 f14 "><span style="color: #7f7f7f;font-size: 14px; ">所部署服务的网址:</span>
<span><a href="http://rubyblog.forge.trustie.net/accounts/login" target="_Blank" style="color: #15BCCF;font-size: 14px;">http://rubyblog.forge.trustie.net/accounts/login</a></span></p>
</div>

View File

@ -1,37 +1,30 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_statistics) %></h2>
</div>
<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;">
<%# 用户每月提交代码次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %>
</p>
<p style="padding-top: 50px;">
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户每月提交代码量 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_qoc_per_author")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的提交次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_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_qoc_per_author")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的代码量 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %>
</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_year")) %>
</p>
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
<% html_title(l(:label_repository), l(:label_statistics)) -%>
<% 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;">
<%# 用户每月提交代码次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %>
</p>
<p style="padding-top: 50px;">
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的提交次数 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %>
</p>
<p style="padding-top: 50px;">
<%# 用户最近六个月的代码量 %>
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %>
</p>
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
<% html_title(l(:label_repository), l(:label_statistics)) -%>
<% end %>

View File

@ -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

@ -48,8 +48,10 @@
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。
迟交扣分
<span class="c_red">&nbsp;<%= student_work.late_penalty%>&nbsp;</span>分,
缺评扣分
<span class="c_red">&nbsp;<%= student_work.absence_penalty%>&nbsp;</span>分,
<% if student_work.homework_common.homework_type == 1%>
缺评扣分
<span class="c_red">&nbsp;<%= student_work.absence_penalty%>&nbsp;</span>分,
<% end%>
最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f",score)%>&nbsp;</span>分。
</div>

View File

@ -24,42 +24,41 @@
<div class="cl"></div>
</li>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class=" b_lblue fb c_w">
<td class="td_tit ">输入</td>
<td class="td_tit border_l ">输出</td>
<td class="td_50 border_l ">测试结果</td>
</tr>
<%@homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit hidden">
<%= test.input%>
</td>
<td class="td_tit border_l hidden">
<%= test.output%>
</td>
<% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
<td class="td_50 c_red border_l"><%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%></td>
<input type="hidden" value="<%= student_work_test.result if student_work_test%>">
</tr>
<% end%>
<% student_work_test = @work.student_work_test.first%>
<% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%>
<tr class="border_t" >
<td colspan="3" class="td_end" >
<%= student_work_test.error_msg%>
</td>
</tr>
<% end%>
</tbody>
</table>
<div class="cl"></div>
</li>
<% if @is_teacher%>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class=" b_lblue fb c_w">
<td class="td_tit ">输入</td>
<td class="td_tit border_l ">输出</td>
<td class="td_50 border_l ">测试结果</td>
</tr>
<%@homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit hidden">
<%= test.input%>
</td>
<td class="td_tit border_l hidden">
<%= test.output%>
</td>
<% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
<td class="td_50 c_red border_l"><%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%></td>
<input type="hidden" value="<%= student_work_test.result if student_work_test%>">
</tr>
<% end%>
<% student_work_test = @work.student_work_test.first%>
<% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%>
<tr class="border_t" >
<td colspan="3" class="td_end" >
<%= student_work_test.error_msg%>
</td>
</tr>
<% end%>
</tbody>
</table>
<div class="cl"></div>
</li>
<!-- 编程作业老师才可以评分 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>

View File

@ -137,22 +137,44 @@
<div class="cl"></div>
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<% @homework.homework_tests.each do |test|%>
<% if @is_teacher%>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
<%=test.input%>
输入
</td>
<td class="td_tit">
<%= test.output%>
输出
</td>
</tr>
<% end%>
</tbody>
</table>
<% @homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit">
<%=test.input%>
</td>
<td class="td_tit">
<%= test.output%>
</td>
</tr>
<% end%>
</tbody>
</table>
<div class="cl"></div>
<% end%>
<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="cl"></div>
<div class="mt5">
<% unless @homework.attachments.empty?%>

View File

@ -44,7 +44,7 @@
</p>
<div class="cl"></div>
<p id="about_project" class="about_project" >
<label class="fl">&nbsp;&nbsp;&nbsp;关联项目&nbsp;&nbsp;&nbsp;&nbsp;</label>
<label class="fl">&nbsp;&nbsp;&nbsp;选择项目&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>
</p>
<div class="cl"></div>
@ -54,7 +54,11 @@
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
&nbsp;&nbsp;&nbsp;
</label>
<%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
<%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%>
<% else %>
<%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
<% end%>
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
</p>

View File

@ -1,15 +1,6 @@
<div id="tags_show">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
<div id="tags">
<div id="tags_show">
<%= render :partial => "tags/tag_project_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
</div>
<% if User.current.logged?%>
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();"><%= l(:label_add_tag)%></a>
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_for "tag_for_save",:remote=>true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
<%= f.text_field :name ,:id => "tags_name",:size=>"20",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class =>"isTxt w90 f_l" %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<input type="button" class="submit f_l" onclick="$('#tags_name').parent().submit();" />
<% end %>
</span>
<% end%>

View File

@ -42,7 +42,7 @@
</span>
<% else %>
<div id="tag">
<span class="tag_show">
<span class="re_tag f_l">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
<!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 -->
<% case object_flag %>

View File

@ -0,0 +1,30 @@
<% @tags = obj.reload.tag_list %>
<% if non_list_all && @tags.size > 0 %>
<% else %>
<!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
<% if @tags.size > 0 %>
<% @tags.each do |tag| %>
<span class="re_tag f_l " id="tag">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
<span class="del">
<%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %>
</span>
</span>
<% end %>
<% end %>
<% end %>
<% if User.current.logged?%>
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag02').slideToggle();"><%= l(:label_add_tag)%></a>
<span id="add_tag02" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_for "tag_for_save",:remote => true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
<%= f.text_field :name ,:id => "tags_name2",:size=>"20",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class =>"isTxt w90 f_l" %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<input type="button" class="submit f_l" onclick="$('#tags_name2').parent().submit();" />
<% end %>
</span>
<% end%>

View File

@ -0,0 +1,30 @@
<% @tags = obj.reload.tag_list %>
<% if non_list_all && @tags.size > 0 %>
<% else %>
<!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
<% if @tags.size > 0 %>
<% @tags.each do |tag| %>
<span class="re_tag f_l " id="tag">
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
<span class="del">
<%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if User.current.eql?(obj) %>
</span>
</span>
<% end %>
<% end %>
<% end %>
<% if User.current.logged?%>
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag03').slideToggle();"><%= l(:label_add_tag)%></a>
<span id="add_tag03" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_for "tag_for_save",:remote => true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
<%= f.text_field :name ,:id => "tags_name3",:size=>"20",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class =>"isTxt w90 f_l" %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<input type="button" class="submit f_l" onclick="$('#tags_name3').parent().submit();" />
<% end %>
</span>
<% end%>

View File

@ -0,0 +1,5 @@
<div id="tags">
<div id="tags_show">
<%= render :partial => "tags/tag_user_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
</div>

View File

@ -2,6 +2,12 @@
<% if @object_flag == '3'%>
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
<% elsif @object_flag == '1'%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
<% elsif @object_flag == '2'%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>');
<% elsif @object_flag == '6'%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',

View File

@ -4,6 +4,14 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
//$('#put-tag-form-issue').hide();
$('#name-issue').val("");
<% elsif @obj_flag == '1'%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$('#tags_name3').val("");
<% elsif @obj_flag == '2'%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$('#tags_name2').val("");
<% elsif @obj_flag == '6'%>
<%if @course%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();

View File

@ -30,7 +30,10 @@
<td>学生人数:</td>
<td><a href="<%= url_for(:controller => 'courses', :action=>"member", :id=>item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %></a></td>
<td>开课学期:</td>
<td><%= item.time %><%= get_course_term_locales item %></td>
<td>
<%= item.time %>
<%= get_course_term_locales item %>
</td>
</tr>
</tbody></table>
</div>
@ -39,8 +42,10 @@
<span class="grey_n_btn fr mt20">课程结束</span>
<% elsif(can_edit_flag) %>
<a href="<%=url_for(:controller => 'homework_common', :action => 'new',:course=>item.id, :host=>Setting.host_course)%>" target="_blank" class="blue_n_btn fr mt20">发布作业</a>
<% else %>
<% elsif User.current.member_of_course? item %>
<a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>" target="_blank" class="blue_n_btn fr mt20">提交作品</a>
<% elsif User.current.logged?%>
<%= link_to "加入课程",try_join_path(:object_id => item.id), :class => "blue_n_btn fr mt20", :remote => "true",:id => "try_join_course_link"%>
<% end %>
<div class="cl"></div>
</div>

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