Merge branch 'develop' into dev_newproject

This commit is contained in:
huang 2016-11-28 15:26:32 +08:00
commit 082f397fd5
241 changed files with 6198 additions and 3895 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ public/javascripts/wechat/node_modules/
.access_token
tmux*.log
config/wechat.yml
config/oneapm.yml

View File

@ -40,9 +40,10 @@ class BlogCommentsController < ApplicationController
end
def show
@article = BlogComment.find(params[:id])
all_comments = []
@replies = get_all_children(all_comments, @article)
@replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc")
@reply_count = @replies.count
@replies = get_no_children_comments_all @replies
@limit_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@replies = @replies[@page * @limit..@page * @limit + 9]

View File

@ -26,7 +26,7 @@ class BlogsController < ApplicationController
@type = 2
@topics.each do |topic|
topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count)
topic[:infocount] = get_praise_num(topic) + BlogComment.where("root_id = #{topic.id}").count
if topic[:infocount] < 0
topic[:infocount] = 0
end

View File

@ -23,7 +23,7 @@ class CoursesController < ApplicationController
before_filter :can_show_course, :except => []
before_filter :logged_user_by_apptoken,:only => [:show,:feedback]
before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses, :join_course_multi_role]
before_filter :find_course, :except => [ :index, :search, :new, :join, :unjoin, :create, :new_join, :course, :join_private_courses, :join_course_multi_role]
before_filter :authorize_course, :only => [:show, :settings, :update, :course]
before_filter :authorize_course_global, :only => [:new,:create]
before_filter :toggleCourse, :only => [:finishcourse, :restartcourse]
@ -303,18 +303,21 @@ class CoursesController < ApplicationController
@member = Member.where(:course_id => @course.id, :user_id => params[:user_id]).first
@member.course_group_id = params[:course_group_id].to_i
@member.save
if params[:group_id] && params[:group_id] != "-1"
@group = CourseGroup.find params[:group_id]
results = student_homework_score(@group.id,0,0,"desc")
@limit = 50
@page = params[:page].nil? ? 1 : params['page'].to_i
@members_count = results.count
@mem_pages = Paginator.new @members_count, @limit, @page
@results = paginateHelper results, @limit
else
@course_groups = @course.course_groups
@no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count
if params[:group_id] != "0"
if params[:group_id] == "-1"
@group = "-1"
else
@group = CourseGroup.find params[:group_id]
end
# results = student_homework_score(@group.id,0,0,"desc")
# @limit = 50
# @page = params[:page].nil? ? 1 : params['page'].to_i
# @members_count = results.count
# @mem_pages = Paginator.new @members_count, @limit, @page
# @results = paginateHelper results, @limit
end
@course_groups = @course.course_groups
@no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count
@canShowCode = isCourseTeacher(User.current.id,@course)
respond_to do |format|
format.js
@ -561,6 +564,7 @@ class CoursesController < ApplicationController
def delete_member
member = @course.members.find params[:member_id]
student_role = member.member_roles.where("role_id = 10").first
teacher_role = member.member_roles.where("role_id = 7 || role_id = 9").first
if member && member.deletable? && student_role
user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, @course.id)
if user_admin.size > 0
@ -569,8 +573,9 @@ class CoursesController < ApplicationController
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id)
joined.destroy_all
if member.member_roles.count > 1
if member.member_roles.count > 1&& student_role && teacher_role
student_role.destroy
teacher_role.update_attribute("is_current", 1)
member.update_attribute("course_group_id", 0)
else
member.destroy
@ -829,11 +834,11 @@ class CoursesController < ApplicationController
end
if @course
#发送微信消息
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
# if count == 0
# ss = SyllabusesService.new
# ss.send_wechat_create_class_notice User.current,@course
# end
count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
if count == 0
ss = SyllabusesService.new
ss.send_wechat_create_class_notice User.current,@course
end
respond_to do |format|
flash[:notice] = l(:notice_successful_create)
format.html {redirect_to course_url(@course)}
@ -1303,6 +1308,21 @@ class CoursesController < ApplicationController
redirect_to user_url(User.current)
end
#归档班级
def archive_course
if params[:source] == "1"
@syllabus = @course.syllabus
end
if params[:type] == "0"
@course.delete!
else
@course.update_attribute(:is_delete, false)
end
respond_to do |format|
format.js
end
end
# 恢复已删除的课程
def renew
if User.current.admin?

View File

@ -374,12 +374,13 @@ class ExerciseController < ApplicationController
=end
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
@exercise_count = @exercise.exercise_users.where('score is not NULL').count
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now)
@exercise_users_list = @exercise.exercise_users.where('score is not NULL')
student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")"
@exercise_count = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}").count
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time <= Time.now)
@exercise_users_list = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}")
@show_all = true;
elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time > Time.now
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id)
elsif !@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time > Time.now
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL and user_id in #{student_id}",User.current.id)
else
@exercise_users_list = []
end
@ -537,7 +538,7 @@ class ExerciseController < ApplicationController
else
# 更新提交状态
cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first
cur_exercise_user.update_attributes(:status => 1)
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1)
# 答题过程中需要统计完成量
@uncomplete_question = get_uncomplete_question(@exercise, User.current)
# 获取改学生的考试得分
@ -618,6 +619,95 @@ class ExerciseController < ApplicationController
score = score1 + score2 + score3
end
#导入试卷的弹框
def other_exercise
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的试卷 进行导入
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
@r_sort = @b_sort == "desc" ? "asc" : "desc"
courses = User.current.courses.not_deleted.select { |course| User.current.allowed_to?(:as_teacher,course)}
course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")"
#none_courses = User.current.courses.where("is_delete = 1 or #{Course.table_name}.id = #{params[:course_id].to_i}")
#none_course_ids = none_courses.empty? ? "(-1)" : "(" + none_courses.map { |course| course.id}.join(',') + ")"
@exercises = Exercise.where("(user_id = #{User.current.id} or course_id in #{course_ids}) and course_id != #{params[:course_id].to_i}").order("#{@order} #{@b_sort}")
@course_id = params[:course_id]
@is_remote = true
@ex_count = @exercises.count
@ex_pages = Paginator.new @ex_count, 10, params['page'] || 1
@offset ||= @ex_pages.offset
@exercises = paginateHelper @exercises,10
respond_to do |format|
format.js
end
end
#搜索导入页面的试卷
def search_exercises
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
@r_sort = @b_sort == "desc" ? "asc" : "desc"
search = params[:name].to_s.strip.downcase
courses = User.current.courses.not_deleted.select { |course| User.current.allowed_to?(:as_teacher,course)}
course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")"
@exercises = Exercise.where("(user_id = #{User.current.id} or course_id in #{course_ids}) and course_id != #{params[:course_id].to_i} and exercise_name like '%#{search}%'").order("#{@order} #{@b_sort}")
@is_remote = true
@ex_count = @exercises.count
@ex_pages = Paginator.new @ex_count, 10, params['page'] || 1
@offset ||= @ex_pages.offset
@exercises = paginateHelper @exercises,10
@course_id = params[:course_id]
respond_to do |format|
format.js
end
end
#将选择的试卷导入到班级
def import_other_exercise
course_id = params[:course_id]
@course = Course.find(course_id)
params[:exercise_id].each_with_index do |ex,i|
exercise = Exercise.find(ex)
option = {
:exercise_name => exercise.exercise_name,
:exercise_status => 1,
:user_id => User.current.id,
:show_result => 1,
:course_id => @course.id,
:time => exercise.time,
:exercise_description => exercise.exercise_description
}
@exercise = Exercise.create option
exercise.exercise_questions.each do |q|
option = {
:question_title => q[:question_title],
:question_type => q[:question_type] || 1,
:question_number => q[:question_number],
:question_score => q[:question_score]
}
@exercise_question = @exercise.exercise_questions.new option
for i in 1..q.exercise_choices.count
choice_option = {
:choice_position => i,
:choice_text => q.exercise_choices[i-1][:choice_text]
}
@exercise_question.exercise_choices.new choice_option
end
for i in 1..q.exercise_standard_answers.count
standard_answer_option = {
:exercise_choice_id => q.exercise_standard_answers[i-1][:exercise_choice_id],
:answer_text => q.exercise_standard_answers[i-1][:answer_text]
}
@exercise_question.exercise_standard_answers.new standard_answer_option
end
end
@exercise.save
end
respond_to do |format|
format.js
end
end
private
#测验列表转换为excel
def exercise_to_xls items

View File

@ -261,20 +261,20 @@ class HomeworkCommonController < ApplicationController
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
if @homework.homework_type != 3
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
else
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = @homework.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
st_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
st_work.save
end

View File

@ -102,6 +102,7 @@ class IssuesController < ApplicationController
@issue_count = @query.issue_count
@test = params[:test]
@project_sort = 'issues.updated_on desc'
if params[:test] != "0"
case @test
when "1"
@ -284,11 +285,11 @@ class IssuesController < ApplicationController
# 用户编辑更改issue
def update
# params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0
# params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0
# params[:fixed_version_id] = nil if params[:fixed_version_id].to_i == 0
if params[:issue_detail]
issue = Issue.find(params[:id])
issue = update_user_issue_detail(issue, params)
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
@saved = update_user_issue_detail(issue, params)
return
else
@ -296,6 +297,7 @@ class IssuesController < ApplicationController
return unless update_issue_from_params
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
@issue.fixed_version_id = nil if @issue.fixed_version_id == 0
saved = false
begin
@saved = @issue.save_issue_with_child_records(params, @time_entry)
@ -630,7 +632,9 @@ class IssuesController < ApplicationController
end
end
# 搜索结果
@issues_filter = @query.issues(:order => @project_sort)
# SELECT assigned_to_id, count(*) as ac FROM `issues` where project_id = @project.id group by assigned_to_id order by ac desc;
@issues_filter = @query.issues.sort_by{ |i| Issue.where(:project_id => @project.id , :assigned_to_id => i.assigned_to_id).count }.reverse
# @issues_filter = @query.issues(:order => @project_sort)
# if params[:type] == 1 || params[:type].nil?
# @results = @issues_filter
@ -668,7 +672,7 @@ class IssuesController < ApplicationController
@alltotal[issue.tracker_id.to_i] = @alltotal[issue.tracker_id.to_i] + 1
user_id = issue.assigned_to_id
if issue.assigned_to_id.nil?
user_id = issue.author_id
user_id = 0
end
if !@results[user_id].nil?
@ -696,7 +700,7 @@ class IssuesController < ApplicationController
tmpuser = User.find(user_id)
@results[user_id][:name] = tmpuser.nil? ? " " : tmpuser.show_name
@results[user_id][:name] = tmpuser.nil? ? "" : tmpuser.show_name
#所有的
@results[user_id][0] = 1
for i in 1..17 do

View File

@ -50,6 +50,8 @@ class MessagesController < ApplicationController
all_comments = []
@replies = Message.where("root_id = #{@topic.id}").reorder("created_on desc")
@reply_count = @replies.count
@replies = get_no_children_comments_all @replies
@limit_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@replies = @replies[@page * @limit..@page * @limit + 9]
@ -171,9 +173,6 @@ class MessagesController < ApplicationController
@reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id
# @reply.reply_id = params[:id]
parent.children << @reply
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@is_course = params[:is_course] if params[:is_course]
@is_board = params[:is_board] if params[:is_board]
else
@quote = params[:quote][:quote]
@reply = Message.new
@ -207,8 +206,8 @@ class MessagesController < ApplicationController
end
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
@is_course = params[:is_course]
@is_board = params[:is_board]
@is_course = params[:is_course] if params[:is_course]
@is_board = params[:is_board] if params[:is_board]
respond_to do |format|
format.js
end
@ -282,8 +281,8 @@ class MessagesController < ApplicationController
@message.destroy
@topic = Message.find(params[:activity_id].to_i)
@user_activity_id = params[:user_activity_id]
@is_course = params[:is_course]
@is_board = params[:is_board]
@is_course = params[:is_course] if params[:is_course]
@is_board = params[:is_board] if params[:is_board]
respond_to do |format|
format.js
end

View File

@ -172,6 +172,8 @@ class NewsController < ApplicationController
@news = result[:news]
@comments = result[:comments]
@comments_count = @comments.count
@comments = get_no_children_comments_all @comments
@limit_count = @comments.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@comments = @comments[@page * @limit..@page * @limit + 9]

View File

@ -41,8 +41,10 @@ class OrgDocumentCommentsController < ApplicationController
@org_subfield = OrgSubfield.where(:id => @document.org_subfield_id).first
@subfield_content = @organization.org_subfields.order("priority")
all_comments = []
@replies = get_all_children(all_comments, @document)
@replies = OrgDocumentComment.where("root_id = #{@document.id}").reorder("created_at desc")
@reply_count = @replies.count
@replies = get_no_children_comments_all @replies
@limit_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@replies = @replies[@page * @limit..@page * @limit + 9]

View File

@ -1,3 +1,4 @@
# encoding: utf-8
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@ -31,7 +32,7 @@ class ProjectsController < ApplicationController
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
before_filter :file, :statistics #:watcherlist
before_filter :file
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
# before_filter :memberAccess, only: :member
@ -534,6 +535,23 @@ class ProjectsController < ApplicationController
end
end
def project_watcherlist
unless @project.nil?
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403
else
@users -= watched.watcher_users if @watched
end
@watchers = @project.watcher_users
@limit = 20
@is_remote = true
@watchers_count = @watchers.count
@watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1
@offset ||= @watcher_pages.offset
@watchers = paginateHelper @watchers, 20
end
end
# include CoursesHelper
def member
# 消息"同意加入项目"
@ -600,6 +618,13 @@ class ProjectsController < ApplicationController
def member_forked
@forked_projects = Project.where(:forked_from_project_id => @project.id)
@limit = 20
@is_remote = true
@forked_count = @forked_projects.count
@forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1
@offset ||= @forked_pages.offset
@forked_projects = paginateHelper @forked_projects, @limit
# @forked_members = User.find_by_sql("SELECT u.* FROM `projects` p,`users` u where p.user_id = u.id and p.forked_from_project_id = #{@project.id} ;")
end
@ -739,7 +764,7 @@ class ProjectsController < ApplicationController
rescue Exception => e
puts e
end
# 删除Trustie班额本库记录
# 删除Trustie本库记录
repoisitory = Repository.where(:project_id => @project.id, :type => GITLABTYPE).first
repoisitory.delete
@project.update_column(:gpid, nil)
@ -769,7 +794,7 @@ class ProjectsController < ApplicationController
end
end
#配置成员弹框
# 配置成员弹框
def delete_member_pop
@member = Member.find(params[:member].to_i)
respond_to do |format|
@ -799,6 +824,31 @@ class ProjectsController < ApplicationController
@project = nil
end
REP_TYPE = "Repository::Gitlab"
# Delete @project's repository
def destroy_repository
if is_project_manager?(User.current.id, @project.id)
@gitlab_repository = Repository.where(:project_id => @project, :type => REP_TYPE).first
@is_true = params[:is_true]
if @is_true
begin
g = Gitlab.client
g.delete_project(@project.gpid)
@gitlab_repository.destroy
@gitlab_repository = nil
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?
@project.update_attribute(:gpid, nil)
rescue Exception => e
puts e
end
end
else
return render_403
end
end
def show_projects_score
respond_to do |format|
format.html { render :layout => "base_projects"}
@ -939,16 +989,6 @@ class ProjectsController < ApplicationController
true
end
def watcherlist
unless @project.nil?
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
render_403
else
@users -= watched.watcher_users if @watched
end
end
end
#gcm
def desc_sort_course_by_avtivity(activity_count,projects)
return projects if activity_count.size<2
@ -962,5 +1002,7 @@ class ProjectsController < ApplicationController
end
return projects
end
#gcmend
end

View File

@ -1,15 +1,19 @@
# encoding: utf-8
# 如果你对改模块任何功能不清楚,请不要随便改
# @Hjqreturn
class PullRequestsController < ApplicationController
before_filter :authorize_logged
before_filter :find_project_and_repository
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new,
:update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request]
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request]
before_filter :member_allowed, :only => [:new, :create]
before_filter :manager_allowed, :only => [:accept_pull_request]
layout "base_projects"
include PullRequestsHelper
include ApplicationHelper
require 'ostruct'
# 返回json格式
def index
# project_menu_type 为了控制base顶部导航
@ -91,10 +95,11 @@ class PullRequestsController < ApplicationController
# 如果分支有改动
if compare_pull_request(source_branch, target_project_id, target_branch)
# 如果传送了目标项目ID即向fork源项目发送请求
if params[:forked_project_id] && params[:source_project] == "forked_project_name"
# if params[:forked_project_id] && params[:source_project] == "forked_project_name"
if !params[:target_project_id].blank?
target_project_id = params[:forked_project_id].to_i
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
@fork_project_name = Project.find(@project.forked_from_project_id).try(:name)
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
@fork_pr_message = true if @fork_project_name
else
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
@ -108,8 +113,14 @@ class PullRequestsController < ApplicationController
format.js{redirect_to new_project_pull_request_path(:show_tip => tip)}
end
end
rescue Gitlab::Error::Forbidden => e
@message = l(:label_pull_request_forbidden)
rescue Gitlab::Error::Conflict => e
@message = l(:label_pull_request_conflic)
rescue Gitlab::Error::NotFound => e
@message = l(:label_pull_request_notfound)
rescue Exception => e
@message = e.message
puts e
end
end
@ -226,7 +237,7 @@ class PullRequestsController < ApplicationController
# Gets the comments on a merge request.
#
# @example
# Gitlab.merge_request_comments(5, 1)
# Gitlab.merge_request_comments(5, 1)
def pull_request_comments
begin
@comments = @g.merge_request_comments(@project.gpid, params[:id]).reverse
@ -269,23 +280,57 @@ class PullRequestsController < ApplicationController
# id (required) - The ID of a project
# merge_request_id (required) - The ID of MR
def pull_request_changes
begin
@type = params[:type]
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
logger.info("###############################{@changes}")
diff = ActiveSupport::JSON.decode(@changes).first
diff = OpenStruct.new(diff)
diff_file = Trustie::Gitlab::Diff::File.new(diff)
logger.info("##############################")
output = ''
diff_file.diff_lines.each_with_index do |line, index|
type = line.type
last_line = line.new_pos
line_old = line.old_pos.to_s
if type == 'match'
## 表示没有修改,两个都要显示行号
output += "|#{line_old.center(4)}|#{last_line.to_s.center(4)}|#{line.text}\n"
else
old_line = type == 'new' ? ' '*4: line_old
new_line = type == 'old' ? ' '*4: last_line
output += "|#{old_line.to_s.center(4)}|#{new_line.to_s.center(4)}|#{line.text}\n"
end
end
@changes_count = @changes.count
@limit = 10
@is_remote = true
@count = @changes_count
@pages = Paginator.new @count, @limit, params['page'] || 1
@offset ||= @pages.offset
@changes = paginateHelper @changes, 10
rescue Exception => e
@message = e.message
end
end
private
# post 相关操作权限控制
# 项目管理员可操作
def manager_allowed
unless is_project_manager?(User.current.id, @project.id)
return render_403
end
end
# 项目成员可操作
def member_allowed
unless User.current.member_of?(@project)
return render_403
end
end
def authorize_logged
if !User.current.logged?
redirect_to signin_path

View File

@ -49,6 +49,7 @@ class RepositoriesController < ApplicationController
helper :repositories
include RepositoriesHelper
helper :project_score
require 'ostruct'
#@root_path = RepositoriesHelper::ROOT_PATH
# require 'net/ssh'
@ -582,6 +583,26 @@ update
@project_menu_type = 5
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
diff = @commit_diff.first
diff = OpenStruct.new(diff)
logger.info("######################{diff}")
@diff_file = Trustie::Gitlab::Diff::File.new(diff)
# diff_file.diff_lines.each_with_index do |line, index|
# type = line.type
# last_line = line.new_pos
# line_old = line.old_pos.to_s
#
#
# if type == 'match'
# ## 表示没有修改,两个都要显示行号
# output += "|#{line_old.center(4)}|#{last_line.to_s.center(4)}|#{line.text}\n"
# else
# old_line = type == 'new' ? ' '*4: line_old
# new_line = type == 'old' ? ' '*4: last_line
# output += "|#{old_line.to_s.center(4)}|#{new_line.to_s.center(4)}|#{line.text}\n"
# end
# end
@commit_details = @g.commit(@project.gpid, params[:changeset])
render :layout => 'base_projects'
end

View File

@ -988,20 +988,20 @@ class StudentWorkController < ApplicationController
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
if @homework.homework_type != 3
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
else
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = @homework.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
st_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
st_work.save
end

View File

@ -92,12 +92,14 @@ class SyllabusesController < ApplicationController
def destroy
if @syllabus && @syllabus.courses.not_deleted.empty?
@syllabus.destroy
redirect_to user_courselist_user_path(User.current.id)
redirect_to user_courselist_user_path(User.current)
end
end
#班级列表
#班级列表 list_type: 1 班级列表 2 归档班级列表
def syllabus_courselist
@list_type = params[:list_type].to_i || 0
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type
@ -110,7 +112,7 @@ class SyllabusesController < ApplicationController
sort_name = "updated_on"
sort_type = @c_sort == 1 ? "asc" : "desc"
@courses = @syllabus.courses.where("is_delete = ?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
@courses = @syllabus.courses.where("is_delete = ?", @list_type).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
#根据 作业+资源数排序
if @order.to_i == 2

View File

@ -90,11 +90,51 @@ class UsersController < ApplicationController
# order 排序条件
# subject 主题搜索用注意搜索和列表调用同一方法通过参数或者remote区分
def user_issues
subject = params[:subject]
author_id = params[:author_id]
@issues = Issue.where("author_id =? or assigned_to_id =? and subject like ?", (author_id ? author_id : @user.id) , @user, "%#{subject}%")
@subject = params[:subject]
# author_id = params[:author_id]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
if @assigned_to.nil?
if author_id.nil?
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and subject like ?",
@user.id , @user.id, "%#{@subject}%").order('updated_on desc')
else
@issues = Issue.where("author_id =? and subject like ?",
author_id , "%#{@subject}%").order('updated_on desc')
end
else
@issues = Issue.where("assigned_to_id =? and subject like ?", @assigned_to, "%#{@subject}%").order('updated_on desc')
end
else
if @assigned_to.nil?
if author_id.nil?
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and project_id=? and subject like ?",
(author_id ? author_id : @user.id) , @user.id, @project_id, "%#{@subject}%").order('updated_on desc')
else
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
author_id , @project_id, "%#{@subject}%").order('updated_on desc')
end
else
@issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
@assigned_to, @project_id, "%#{@subject}%").order('updated_on desc')
end
end
@issues_filter = Issue.where("author_id =? or assigned_to_id =?", (author_id ? author_id : @user.id) , @user).order('updated_on desc')
@issues_assigned_count = Issue.where("assigned_to_id =? and subject like ?", @user.id, "%#{@subject}%").count
@issues_author_count = Issue.where("author_id =? and subject like ?", @user.id, "%#{@subject}%").count
@issue_open_count = Issue.where(" (author_id =? or assigned_to_id =?) and status_id in (1,2,3,4,6)", (author_id ? author_id : @user.id) , @user).count
@issue_close_count = Issue.where("(author_id =? or assigned_to_id =?) and status_id = 5", (author_id ? author_id : @user.id) , @user.id).count
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
respond_to do |format|
format.html{render :layout => 'new_base_user'}
format.html{render :layout => 'static_base'}
format.api
format.js
end
@ -105,7 +145,7 @@ class UsersController < ApplicationController
case params[:type]
when 'JournalsForMessage'
@comment = JournalsForMessage.find params[:comment].to_i
when 'Message'
when 'Message','is_project_message'
@comment = Message.find params[:comment].to_i
when 'BlogComment'
@comment = BlogComment.find params[:comment].to_i
@ -113,9 +153,11 @@ class UsersController < ApplicationController
@comment = OrgDocumentComment.find params[:comment].to_i
when 'Comment'
@comment = Comment.find params[:comment].to_i
when 'Journal'
when 'Journal','is_project_issue'
@comment = Journal.find params[:comment].to_i
end
@user_activity_id = params[:user_activity_id]
@parent_id = params[:parent_id] if params[:parent_id]
end
#二级回复
@ -131,7 +173,6 @@ class UsersController < ApplicationController
else
@user_activity_id = -1
end
@hw_status = params[:hw_status].to_i
when 'JournalsForMessage'
@reply = JournalsForMessage.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@ -141,15 +182,11 @@ class UsersController < ApplicationController
@reply = Message.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@is_course = params[:is_course]
@is_board = params[:is_board]
@type = 'Message'
when 'BlogComment'
@reply = BlogComment.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@homepage = params[:homepage]
@user_id = params[:user_id]
@type = 'BlogComment'
when 'OrgDocumentComment'
@reply = OrgDocumentComment.find params[:reply_id]
@ -175,6 +212,104 @@ class UsersController < ApplicationController
end
end
#叠层回复框中的回复
def reply_to_comment
@type = params[:type]
@reply = get_reply_by_type @type, params[:reply_id]
@parent_id = params[:parent_id] if params[:parent_id]
@user_activity_id = params[:user_activity_id]
@is_project = params[:is_project] if params[:is_project]
respond_to do |format|
format.js
end
end
#多级回复
def reply_detail
@type = params[:type]
reply = get_reply_by_type @type, params[:reply_id]
if @type == 'JournalsForMessage'
if reply.jour_type == "HomeworkCommon"
@type = "HomeworkCommon"
elsif reply.jour_type == "Syllabus"
@type = "Syllabus"
end
end
@user_activity_id = params[:user_activity_id]
case @type
when 'HomeworkCommon'
@root = HomeworkCommon.find reply.jour_id
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => User.current.id,:m_parent_id => params[:reply_id].to_i,:m_reply_id => params[:reply_id].to_i, :root_id => reply.root_id}
comment = HomeworkCommon.add_homework_jour(User.current, params[:reply_message], reply.jour_id, reply.root_id, options)
@root.update_column('updated_at', Time.now)
@is_teacher = User.current.allowed_to?(:as_teacher, @root.course) || User.current.admin?
when 'JournalsForMessage'
options = {:user_id => User.current.id,
:status => true,
:m_parent_id => params[:reply_id],
:m_reply_id => params[:reply_id],
:reply_id => reply.user.id,
:notes => params[:reply_message],
:root_id => reply.root_id,
:is_readed => false}
@root = reply.root
comment = add_reply_adapter(@root, options)
@root.update_attribute(:updated_on,Time.now)
when 'Message'
@root = reply.root
comment = Message.new
comment.author = User.current
comment.board = reply.board
comment.content = params[:reply_message]
comment.subject = "RE: #{@root.subject}"
comment.reply_id = params[:reply_id]
comment.root_id = reply.root_id
reply.children << comment
@is_project = params[:is_project] if params[:is_project]
when 'BlogComment'
@root = reply.root
comment = BlogComment.new
comment.author = User.current
comment.blog = reply.blog
comment.title = "RE: #{@root.title}"
comment.content = params[:reply_message]
comment.reply_id = params[:reply_id]
comment.root_id = reply.root_id
reply.children << comment
when 'OrgDocumentComment'
@root = reply.root
comment = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:reply_id])
comment.title = "RE:#{@root.title}"
comment.content = params[:reply_message]
comment.root_id = reply.root_id
reply.children << comment
when 'News','Comment'
@root = News.find reply.commented_id
comment = @root.comments.build(:author_id => User.current.id, :reply_id => params[:reply_id], :comments => params[:reply_message], :parent_id => reply.id)
comment.save
when 'Issue', 'Journal'
@root = reply.issue
comment = @root.journals.build(:user_id => User.current.id, :reply_id => params[:reply_id], :notes => params[:reply_message], :parent_id => reply.id)
comment.save
@is_project = params[:is_project] if params[:is_project]
when 'Syllabus'
@root = Syllabus.find reply.jour_id
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => User.current.id,:m_parent_id => params[:reply_id].to_i,:m_reply_id => params[:reply_id].to_i, :root_id => reply.root_id}
comment = Syllabus.add_syllabus_jour(User.current, params[:reply_message], reply.jour_id, reply.root_id, options)
@root.update_column('updated_at', Time.now)
@count = @root.journals_for_messages.count
@comments = @root.journals_for_messages.reorder("created_on desc").limit(3)
end
update_course_activity(@root.class.to_s,@root.id)
update_user_activity(@root.class.to_s,@root.id)
update_forge_activity(@root.class.to_s,@root.id)
update_org_activity(@root.class.to_s,@root.id)
update_principal_activity(@root.class.to_s,@root.id)
respond_to do |format|
format.js
end
end
def refresh_changests
if !(@user.nil?) && !(@user.memberships.nil?)
@user.memberships.each do |member|
@ -390,13 +525,13 @@ class UsersController < ApplicationController
member.course_group_id = 0
member.save
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
else
members = []
members << Member.new(:role_ids => integer_ids, :user_id => @msg.course_message_id)
Course.find(@msg.course_id).members << members
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
if integer_ids.include?(9)
@ -411,7 +546,7 @@ class UsersController < ApplicationController
end
when 'N'
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
@msg.update_attributes(:status=>2,:viewed=>1)
if integer_ids.include?(9)
@ -461,13 +596,13 @@ class UsersController < ApplicationController
when 'Y'
unless ah.empty?
ah.first.update_column('status', 2)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>1)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>1)
@msg.update_attributes(:apply_result=>1,:viewed=>1)
end
when 'N'
unless ah.empty?
ah.first.update_column('status', 3)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>2)
CourseMessage.create(:user_id => @msg.apply_user_id, :course_id => @msg.course_id, :viewed => false,:course_message_id=>@msg.course_message_id,:content=>@msg.content,:course_message_type=>'HomeworkCommon',:status=>6,:apply_result=>2)
@msg.update_attributes(:apply_result=>2,:viewed=>1)
end
end
@ -1329,9 +1464,10 @@ class UsersController < ApplicationController
@jour = jours.limit(10).offset(@page * 10)
@type = params[:type]
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)
@jour.update_all(:is_readed => true, :status => false)
@jour.each do |journal|
# fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
journal.delay.set_children_readed_delay
end
end
@state = false
@ -3357,7 +3493,11 @@ class UsersController < ApplicationController
@my_syllabuses = @user.syllabuses
my_syllabus_ids = @my_syllabuses.empty? ? "(-1)" : "(" + @my_syllabuses.map{|syllabus| syllabus.id}.join(',') + ")"
if @user == User.current
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").map{|course| course.syllabus_id}.join(",") + ")"
@archive_syllabuses = Syllabus.where("id in #{archive_ids}")
end
sy_courses = @user.courses.visible.not_deleted
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
syllabus_members = SyllabusMember.where("user_id = #{@user.id}")
@ -3429,11 +3569,58 @@ class UsersController < ApplicationController
end
end
#归档班级列表
def user_archive_courses
if User.current.logged?
@order, @c_sort, @type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type
if @order.to_i == @type.to_i
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
else
@c_sort = 2
end
@user = User.current
sort_name = "updated_at"
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1 and syllabus_id is NOT NULL").map{|course| course.syllabus_id}.join(",") + ")"
@archive_syllabuses = Syllabus.where("id in #{archive_ids}")
if @order.to_i == 1 #根据 班级更新时间排序
@archive_syllabuses = syllabus_course_list_sort @archive_syllabuses
@c_sort == 1 ? (@archive_syllabuses = @archive_syllabuses.sort{|x,y| x[:last_update] <=> y[:last_update] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]})
@type = 1
elsif @order.to_i == 2 #根据 作业+资源数排序
@type = 2
@archive_syllabuses.each do |syllabus|
count = 0
courses = syllabus.courses.not_deleted
courses.each do |c|
count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count)
end
syllabus[:infocount] = count
end
@c_sort == 1 ? (@archive_syllabuses = @archive_syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]})
@archive_syllabuses = sortby_time_countcommon_nosticky @archive_syllabuses,sort_name
else
@type = 1
end
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
end
end
#展开课程下的班级
def expand_courses
@syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first
unless @syllabus.nil?
@courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
if params[:is_delete] && params[:is_delete] == '1'
@courses = @syllabus.courses.where("is_delete = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
else
@courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
end
respond_to do |format|
format.js
end
@ -3526,18 +3713,12 @@ class UsersController < ApplicationController
if params[:type].present?
case params[:type]
when 'OrgDocumentComment'
#obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@type = 'OrgDocumentComment'
#comments = []
@journals = OrgDocumentComment.where("root_id = #{params[:id].to_i}").reorder("created_at desc")
when 'Message','is_project_message'
#obj = Message.where('id = ?', params[:id].to_i).first
@type = 'Message'
@is_course = params[:is_course]
@is_board = params[:is_board]
@user_activity_id = params[:div_id].to_i if params[:div_id]
#comments = []
@journals = Message.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'News'
obj = News.where('id = ?', params[:id].to_i).first
@ -3550,8 +3731,6 @@ class UsersController < ApplicationController
@type = 'Syllabus'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'JournalsForMessage'
#obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
#journals = []
@journals = JournalsForMessage.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
@type = 'JournalsForMessage'
@user_activity_id = params[:div_id].to_i if params[:div_id]
@ -3568,20 +3747,17 @@ class UsersController < ApplicationController
when 'BlogComment'
obj = BlogComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@homepage = params[:homepage].to_i
@type = 'BlogComment'
@user_id = obj.author_id
#comments = []
@journals = BlogComment.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'HomeworkCommon'
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
@type = 'HomeworkCommon'
@journals = obj.journals_for_messages.reorder("created_on desc")
@hw_status = params[:hw_status].to_i if params[:hw_status]
@is_teacher = User.current.allowed_to?(:as_teacher,obj.course)
@user_activity_id = params[:user_activity_id].to_i if params[:user_activity_id]
end
end
@journals = get_no_children_comments_all @journals
end
def homepage

View File

@ -125,7 +125,8 @@ class VersionsController < ApplicationController
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
# @offset ||= @issue_pages.offset
@issues = paginateHelper @version_issues, @limit
@version_issue_assigned_name = @version_issues.group_by(&:assigned_to_id)
@version_issue_assigned_name = @version_issues.sort_by{ |i| Issue.where(:project_id => @project.id ,
:assigned_to_id => i.assigned_to_id, :fixed_version_id => @version.id).count }.reverse.group_by(&:assigned_to_id)
format.html {
# @issues = @version.fixed_issues.visible.
# includes(:status, :tracker, :priority).

View File

@ -37,7 +37,9 @@ class WatchersController < ApplicationController
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@action = 'fans'
else
if params[:target_id]
@user = User.find(params[:target_id])
end
end
if params[:object_type] == 'project'
@ -78,6 +80,9 @@ class WatchersController < ApplicationController
@list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all();
@action = 'fans'
else
if params[:target_id]
@user = User.find(params[:target_id])
end
end
if params[:object_type] == 'project'
@project = Project.find(params[:object_id])

View File

@ -137,7 +137,7 @@ class WechatsController < ActionController::Base
on :fallback, respond: 'fallback message'
on :click, with: 'FEEDBACK' do |request, key|
request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框发微信给我们。\n2、加入QQ群373967360直接互动。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机13467631747\nQQ494496321"
request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框发微信给我们。\n2、加入QQ群373967360直接互动。\n3、登录网站www.trustie.net给我们留言。\n\n如您有合作事宜洽谈,请联系:\n王林春 老师\n手机13467631747\nQQ494496321"
end
on :click, with: 'MY_NEWS' do |request, key|

View File

@ -116,7 +116,7 @@ class WordsController < ApplicationController
else
@user_activity_id = -1
end
@hw_status = params[:hw_status].to_i
@hw_status = params[:hw_status].to_i if
@is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin?
elsif @journal_destroyed.jour_type == 'Syllabus'
@syllabus = Syllabus.find @journal_destroyed.jour_id
@ -315,7 +315,7 @@ class WordsController < ApplicationController
respond_to do |format|
format.js{
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
@hw_status = params[:hw_status].to_i if params[:hw_status]
@is_teacher = User.current.allowed_to?(:as_teacher, @homework_common.course) || User.current.admin?
}
end
@ -349,7 +349,7 @@ class WordsController < ApplicationController
respond_to do |format|
format.js{
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
@hw_status = params[:hw_status].to_i if params[:hw_status]
@is_teacher = User.current.allowed_to?(:as_teacher, @homework_common.course) || User.current.admin?
}
end
@ -454,45 +454,5 @@ class WordsController < ApplicationController
end
obj
end
def add_reply_adapter obj, options
#modify by nwb
#添加对课程留言的支持
#留言回复应该不关系其所属的Class而关心的是其所属的父留言
case obj.jour_type
when 'Principal'
obj.jour.add_jour(nil, nil, nil, options)
when 'Project'
Project.add_new_jour(nil, nil, obj.jour_id, options)
when 'Course'
Course.add_new_jour(nil, nil, obj.jour_id, options)
when 'Bid'
obj.jour.add_jour(nil, nil, nil, options)
when 'Contest'
obj.jour.add_jour(nil, nil, obj.jour_id, options)
when 'Softapplication'
obj.jour.add_jour(nil, nil, obj.jour_id, options)
when 'HomeworkAttach'
obj.jour.add_jour(nil, nil, obj.jour_id, options)
end
# obj = obj_distinguish_url_origin || User.find_by_id(2)
# if obj.kind_of? User
# obj.add_jour(nil, nil, nil, options)
# elsif obj.kind_of? Project
# Project.add_new_jour(nil, nil, obj.id, options)
# elsif obj.kind_of? Course
# Course.add_new_jour(nil, nil, obj.id, options)
# elsif obj.kind_of? Bid
# obj.add_jour(nil, nil, nil, options)
# elsif obj.kind_of? Contest
# obj.add_jour(nil, nil, obj.id, options) #new added
# elsif obj.kind_of? Softapplication
# obj.add_jour(nil, nil, obj.id, options) #new added
# elsif obj.kind_of? HomeworkAttach
# obj.add_jour(nil, nil, obj.id, options) #new added
# else
# raise "create reply obj unknow type.#{obj.class}"
# end
end
#######end of message
end

View File

@ -2837,6 +2837,12 @@ module ApplicationHelper
tag_list
end
# 获取项目fork成员数
def project_fork_count
@forked_projects = Project.where(:forked_from_project_id => @project.id)
@forked_count = @forked_projects.count
end
def get_org_subfield_tag_list org_subfield
all_attachments = org_subfield.attachments.select{|attachment| attachment.is_public? ||
(attachment.container_type == "OrgSubfield" && User.current.member_of_org?(org_subfield.organization))||
@ -3394,6 +3400,63 @@ def secdomain_with_protocol secdomain
return Setting.protocol + "://" + secdomain + ".trustie.net"
end
#根据回复类型获取回复
def get_reply_by_type type, reply_id
reply = nil
case type
when 'HomeworkCommon'
reply = JournalsForMessage.find reply_id
when 'JournalsForMessage'
reply = JournalsForMessage.find reply_id
when 'Message'
reply = Message.find reply_id
when 'BlogComment'
reply = BlogComment.find reply_id
when 'OrgDocumentComment'
reply = OrgDocumentComment.find reply_id
when 'News','Comment'
reply = Comment.find reply_id
when 'Issue'
reply = Journal.find reply_id
when 'Journal'
reply = Journal.find reply_id
when 'Syllabus'
reply = JournalsForMessage.find reply_id
end
reply
end
#获取不包含子节点的回复(前三个)
def get_no_children_comments comments
result = {}
no_children_comments = []
count = 0
three_more = false
comments.each do |comment|
if comment.children.blank?
count = count + 1
if count > 3
three_more = true
end
break if count > 3
no_children_comments << comment
end
end
result[:three_more] = three_more
result[:no_children_comments] = no_children_comments
result
end
#获取不包含子节点的回复(所有)
def get_no_children_comments_all comments
no_children_comments = []
comments.each do |comment|
if comment.children.blank?
no_children_comments << comment
end
end
no_children_comments
end
#获取回复的所有父节点
def get_reply_parents parents_rely, comment
@ -3727,6 +3790,9 @@ end
#作业类型
def homework_type_option
type = []
option0 = []
option0 << "请选择作业类型"
option0 << 0
option1 = []
option1 << "普通作业"
option1 << 1
@ -3736,9 +3802,50 @@ def homework_type_option
option3 = []
option3 << "分组作业"
option3 << 3
type << option0
type << option1
type << option2
type << option3
type
end
def add_reply_adapter obj, options
#modify by nwb
#添加对课程留言的支持
#留言回复应该不关系其所属的Class而关心的是其所属的父留言
case obj.jour_type
when 'Principal'
obj.jour.add_jour(nil, nil, nil, options)
when 'Project'
Project.add_new_jour(nil, nil, obj.jour_id, options)
when 'Course'
Course.add_new_jour(nil, nil, obj.jour_id, options)
#when 'Bid'
# obj.jour.add_jour(nil, nil, nil, options)
#when 'Contest'
# obj.jour.add_jour(nil, nil, obj.jour_id, options)
#when 'Softapplication'
# obj.jour.add_jour(nil, nil, obj.jour_id, options)
#when 'HomeworkAttach'
# obj.jour.add_jour(nil, nil, obj.jour_id, options)
end
# obj = obj_distinguish_url_origin || User.find_by_id(2)
# if obj.kind_of? User
# obj.add_jour(nil, nil, nil, options)
# elsif obj.kind_of? Project
# Project.add_new_jour(nil, nil, obj.id, options)
# elsif obj.kind_of? Course
# Course.add_new_jour(nil, nil, obj.id, options)
# elsif obj.kind_of? Bid
# obj.add_jour(nil, nil, nil, options)
# elsif obj.kind_of? Contest
# obj.add_jour(nil, nil, obj.id, options) #new added
# elsif obj.kind_of? Softapplication
# obj.add_jour(nil, nil, obj.id, options) #new added
# elsif obj.kind_of? HomeworkAttach
# obj.add_jour(nil, nil, obj.id, options) #new added
# else
# raise "create reply obj unknow type.#{obj.class}"
# end
end

View File

@ -264,7 +264,19 @@ module ProjectsHelper
# Returns a set of options for a select field, grouped by project.
def version_options_for_select(versions, selected=nil)
project_name = versions.blank? ? "" : versions.first.project.name
grouped = Hash.new {|h,k| h[k] = []}
grouped[project_name] << ["请选择里程碑", 0]
=begin
unless selected.nil?
if (params[:action] == "show" ) && Version.find(selected.id).status == "closed"
version_name = Version.find(selected.id).name
grouped[project_name] << [version_name, selected.id]
end
end
=end
versions.each do |version|
grouped[version.project.name] << [version.name, version.id]
end
@ -300,6 +312,16 @@ module ProjectsHelper
type << option2
end
# 判断用户是否为项目管理员
def is_project_manager?(user_id, project_id)
@result = false
mem = Member.where("user_id = ? and project_id = ?",user_id, project_id)
unless mem.blank?
@result = mem.first.roles.to_s.include?("Manager") ? true : false
end
return @result
end
# 用来判断用户是否是项目的管理员
# added by william
def is_manager?(user_id,project_id)

View File

@ -2,12 +2,12 @@ module PullRequestsHelper
# 获取diff内容行号
def diff_line_num content
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
result = content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
end
# 处理内容
def diff_content content
content.gsub!(/.*@@ -\d+,\d+ \+\d+,\d+ @@\n/m,'')
result = content.gsub!(/.*@@.*@@\n/m,'')
end
def get_user_name user_id
@ -19,6 +19,11 @@ module PullRequestsHelper
PullRequest.where(:pull_request_id => pull_request_id).first
end
# 通过gitlab项目id获取Trustie项目的用户名
def find_gitlab_project gitlab_project_id
Project.find_by_gpid(gitlab_project_id).owner.try(:show_name)
end
def get_state state
case state
when "open","reopened"

View File

@ -29,6 +29,30 @@ module UsersHelper
["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
end
def issue_list(issues, &block)
ancestors = []
issues.each do |issue|
while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
ancestors.pop
end
yield issue, ancestors.size
ancestors << issue unless issue.leaf?
end
end
# 我的issue 来源
def options_for_issue_project_list( issues )
issues = issues.group_by{|issue| issue.project_id}
issues.map{ |issue| [Project.find(issue[0]).name, issue[0]]}.unshift(["来源", 0])
end
# 我的issue指派给我
def options_for_my_issue_list(issues)
# issues = issues.group_by{|issue| issue.assigned_to_id }
# issues.map{ |issue| [User.find(issue[0]).show_name, issue[0]]}.unshift(["指派给", 0])
end
def get_resource_type type
case type
when 'Course'
@ -76,7 +100,7 @@ module UsersHelper
def applied_project_users applied_message
# case applied_message.status
# when 3,2,1,5,4,7,6
user = User.find(applied_message.applied_user_id)
user = User.find(applied_message.applied_user_id).show_name
# end
end

View File

@ -333,6 +333,7 @@ module WatchersHelper
return '' unless user && user.logged?
objects = Array.wrap(objects)
watched = objects.any? {|object| object.watched_by?(user)}
watched = true if user.id == @project.user_id
@watch_flag = objects.first.instance_of?(Project)
id = watcher_css(objects)
text = @watch_flag ?
@ -340,8 +341,13 @@ module WatchersHelper
url = watch_path(:object_type => objects.first.class.to_s.underscore,
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort))
method = watched ? 'delete' : 'post'
link_to text, url, :remote => true, :method => method,
:class => "pro_new_topbtn_left fl" ,:id=>id
if user.id != @project.user_id
link_to text, url, :remote => true, :method => method,
:class => "pro_new_topbtn_left fl" ,:id => id
else
link_to "关注", "javascript:void(0)", :remote => true, :method => method,
:class => "pro_new_grey_topbtn_left fl" , :id => id
end
end
def store_project_link project_id, user_id

View File

@ -1,4 +1,5 @@
class ExerciseUser < ActiveRecord::Base
#commit_status 0:未交 1:已交
include Redmine::SafeAttributes
belongs_to :user

View File

@ -15,7 +15,7 @@ class HomeworkCommon < ActiveRecord::Base
has_one :homework_detail_group, :dependent => :destroy
has_many :student_work_projects, :dependent => :destroy
has_many :homework_tests, :dependent => :destroy
has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
has_many :student_works, :dependent => :destroy, :conditions => "is_test=0 and is_delete != 1"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :apply_homeworks, :dependent => :destroy

View File

@ -854,7 +854,8 @@ class Issue < ActiveRecord::Base
return @assignable_versions if @assignable_versions
# versions = project.shared_versions.open.all
versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc")
# versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc")
versions = Version.where(:project_id => project.id).order("created_on desc")
if fixed_version
if fixed_version_id_changed?
# nothing to do

View File

@ -344,4 +344,9 @@ class JournalsForMessage < ActiveRecord::Base
def content_detail
self.notes
end
def set_children_readed_delay
# fetch_user_leaveWord_reply(self).update_all(:is_readed => true, :status => false)
end
end

View File

@ -9,6 +9,7 @@ class Organization < ActiveRecord::Base
has_many :org_subfields, :dependent => :destroy
has_many :users, :through => :org_members
has_many :files
has_many :org_messages, :class_name => 'OrgMessage', :dependent => :destroy
acts_as_attachable
validates_uniqueness_of :name
after_create :save_as_org_activity, :add_default_subfields

View File

@ -4,7 +4,7 @@ class StudentWork < ActiveRecord::Base
belongs_to :homework_common
belongs_to :user
has_many :student_work_projects
has_many :student_work_projects, :dependent => :destroy
has_many :student_works_evaluation_distributions, :dependent => :destroy
has_many :student_works_scores, :dependent => :destroy
belongs_to :project

View File

@ -9,11 +9,21 @@ class StudentsForCourse < ActiveRecord::Base
validates_uniqueness_of :student_id, :scope => :course_id
after_destroy :delete_student_works
after_create :recovery_student_works
#退出班级或删除学生时隐藏学生的作品
def delete_student_works
course = self.course
homework_ids = course.homework_commons.blank? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{self.student_id} && homework_common_id in #{homework_ids}")
student_works.destroy_all
student_works.update_all(:is_delete => 1)
end
#加入班级时还原作品
def recovery_student_works
course = self.course
homework_ids = course.homework_commons.blank? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{self.student_id} && homework_common_id in #{homework_ids}")
student_works.update_all(:is_delete => 0)
end
end

View File

@ -452,12 +452,20 @@ class CoursesService
@state = 2
return @state
end
@member = Member.where('course_id = ? and user_id = ?', params[:object_id], user.id)
if @member.nil? || @member.count == 0
@member = Member.where('course_id = ? and user_id = ?', params[:object_id], user.id).first
if @member.nil?
@state = 1
return @state
end
@member.first.destroy
student_role = @member.member_roles.where("role_id = 10").first
teacher_role = @member.member_roles.where("role_id = 7 || role_id = 9").first
if @member.member_roles.count > 1 && student_role && teacher_role
student_role.destroy
teacher_role.update_attribute("is_current", 1)
@member.update_attribute("course_group_id", 0)
else
@member.destroy
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
joined.each do |join|
join.destroy

View File

@ -30,9 +30,9 @@
<% 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%>
<% 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] %>
<% if User.current.logged? %>
@ -42,15 +42,15 @@
<% end %>
<% else %>
<% if User.current.logged? %>
<%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
<%= link_to_short_attachment attachment, :length => 58,:class => 'hidden link_file_a fl newsBlue mw400 h15', :download => true -%>
<% else %>
<%= link_to(attachment.filename, signin_url_without_domain,:length=> 58, :class => "hidden link_file_a fl newsBlue mw400") %>
<%= link_to(attachment.filename, signin_url_without_domain,:length => 58, :class => "hidden link_file_a fl newsBlue mw400 h15") %>
<% end %>
<% end %>
</span>
<%if is_float%>
<% if is_float %>
</div>
<% end%>
<% end %>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),

View File

@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<%= render :partial => 'users/message_contents', :locals => {:comment => comment, :type => 'BlogComment', :user_activity_id => @article.id}%>
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
@ -52,7 +52,7 @@
<div class="cl"></div>
</li>
<% end %>
<% if @reply_count > @page * @limit + 10 %>
<% if @limit_count > @page * @limit + 10 %>
<div id="more_blog_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>

View File

@ -1,7 +1,8 @@
<% if @in_user_homepage %>
<% homepage = BlogComment.find(@user.blog.homepage_id) %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => @blog_comment, :user_activity_id => homepage.id}) %>");
<% else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>");
<% end %>
<%# if @in_user_homepage %>
<%# homepage = BlogComment.find(@user.blog.homepage_id) %>
//$("#user_activity_<%#= @user_activity_id%>").replaceWith("<%#= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => @blog_comment, :user_activity_id => homepage.id}) %>");
<%# else%>
//$("#user_activity_<%#= @user_activity_id%>").replaceWith("<%#= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>");
<%# end %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_blog_post_reply', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');

View File

@ -1,11 +1,12 @@
<% if @in_user_homepage %>
<% homepage = BlogComment.find(@user.blog.homepage_id) %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id}) %>");
<% elsif @in_user_center%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
<%# if @in_user_homepage %>
<%# homepage = BlogComment.find(@user.blog.homepage_id) %>
//$("#user_activity_<%#= @user_activity_id%>").replaceWith("<%#= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id}) %>");
<%# elsif @in_user_center%>
//$("#user_activity_<%#= @user_activity_id%>").replaceWith("<%#= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
// init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
<% else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
<%# else%>
//$("#user_activity_<%#= @user_activity_id%>").replaceWith("<%#= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
//init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
<% end %>
<%# end %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_blog_post_reply', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');

View File

@ -109,9 +109,7 @@
<div class="cl"></div>
</div>
<div class="cl"></div>
<% all_comments = []%>
<% all_replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc") %>
<% count= all_replies.count %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
@ -124,7 +122,6 @@
<div class="homepagePostReplyBannerTime"></div>
</div>
<%# comments = all_replies %>
<% if @reply_count > 0 %>
<div class="" id="reply_div_<%= @article.id %>">
<%= render :partial => 'blog_comment_show_replies' %>

View File

@ -1,7 +1,7 @@
<div class = "cl"> </div>
<div id="blog-list">
<div class="listbox mt10" >
<h2 class="list-h2">博客列表</h2>
<p class="list-h2">博客列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
@ -21,9 +21,9 @@
<ul class="list-file">
<li><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=> activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl" %>
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=> activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title-normal fl" %>
<% else %>
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title fl"%>
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author, :blog_id=>activity.blog.id,:id=>activity), :class=> "list-title-normal fl"%>
<% end %>
<%# if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
<!--<span class="font_normal ml10 fr">[已设为首页]</span>-->
@ -36,7 +36,8 @@
<% end %>
<div class="cl"></div>
</li>
<% count=BlogComment.where("root_id = #{activity.id}").count%> <li class="ml15">
<% count=BlogComment.where("root_id = #{activity.id}").count%>
<li class="ml15">
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>
<p class="list-info fr grayTxt">

View File

@ -45,16 +45,15 @@
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_repies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_repies.count %>
<% no_children_comments = get_no_children_comments all_repies %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1, :expand_more =>no_children_comments[:three_more]} %>
<% comments = all_repies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1, :user_id => activity.author_id}%>
<%= render :partial => 'users/message_replies', :locals => {:comments => no_children_comments[:no_children_comments], :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1, :user_id => activity.author_id}%>
</div>
<% end %>

View File

@ -20,10 +20,6 @@
{
params.contentmsg.text("描述不能为空");
params.contentmsg.css('color','#ff0000');
}
else if(params.content.html().length >=20000){
params.contentmsg.text("描述最多20000个汉字(或40000个英文字符)");
params.contentmsg.css('color','#ff0000');
result=false;
}
else
@ -177,7 +173,7 @@
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
<% else %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn" onclick="submit_topic();">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
<% end %>

View File

@ -2,7 +2,7 @@
<% if @news.project_id && @news.project_id != -1 %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% elsif @news.course_id %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/course_news_post_reply', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% elsif @news.org_subfield_id %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% end %>

View File

@ -2,7 +2,7 @@
<% if @news.project_id && @news.project_id != -1 %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% elsif @news.course_id %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/course_news_post_reply', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% elsif @news.org_subfield_id %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% end %>

View File

@ -12,38 +12,59 @@
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none !important; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 17px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
<script type="text/javascript">
$(function(){
if(window.history.length == 1)
{
$("#history_back").css("background","#CCC");
$("#history_back").css("color","#CCC");
$("#history_back").css("cursor","default");
}
$("#subject").keydown(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
}).keyup(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
});
});
</script>
</head>
<body>
<div class="error_content">
<div class="error_left">403</div>
<div class="error_right">
<p>ERROR FORBIDDEN<br />
没有访问权限!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()" id="history_back">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
<div class="muban_conbox_max">
<div class="pages_new_404">
<img src="/images/404/pic_403.jpg" >
<p class="pages_new_404_txt mt40">
您没有访问权限,请先获取相应权限。
<a href="javascript:history.back()" id="history_back" class="linkBlue2 ml5 mr10">返回上页>></a>
<a href="javascript:void(0)" class="linkBlue2 ml5 mr10" onclick="$('#feedback_div').toggle();"> 给我留言>></a>
<a href="http://shang.qq.com/wpa/qunwpa?idkey=064e805dac955b8aea158c4b0dd3f033b8841bcee175fd619613f0e4ac4d8151" target="_blank" class="linkBlue2">QQ反馈>></a>
</p>
<div style="display:none;" class="ml10 mt10" id="feedback_div">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject, :id=>"subject", :class => "feedbackText mb5", :placeholder => "请在此输入平台的问题和建议您也可以通过QQ留言谢谢" %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_grey fl">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" onclick="$('#new_memo').submit();">&nbsp;&nbsp;</a>
<a href="javascript:void(0);" class="sy_btn_grey_mini f12 fr mr10" onclick="$('#feedback_div').hide();">&nbsp;&nbsp;</a>
<div class="cl"></div>
<% end %>
</div>
</div>
</div>
</body>
</html>

View File

@ -12,30 +12,60 @@ ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 18px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
<script type="text/javascript">
$(function(){
if(window.history.length == 1)
{
$("#history_back").css("color","#CCC");
$("#history_back").css("cursor","default");
}
$("#subject").keydown(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
}).keyup(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
});
});
</script>
</head>
<body>
<div class="muban_conbox_max">
<div class="pages_new_404">
<img src="/images/404/pic_404.jpg" >
<p class="pages_new_404_txt mt40">
非常抱歉,您访问的页面不存在或已删除。
<a href="javascript:history.back()" id="history_back" class="linkBlue2 mr10">返回上页>></a>
<a href="javascript:void(0)" class="linkBlue2 mr10" onclick="$('#feedback_div').toggle();"> 给我留言>></a>
<a href="http://shang.qq.com/wpa/qunwpa?idkey=064e805dac955b8aea158c4b0dd3f033b8841bcee175fd619613f0e4ac4d8151" target="_blank" class="linkBlue2">QQ反馈>></a>
</p>
<div class="error_content">
<div class="error_left">404</div>
<div class="error_right">
<p><span style="font-size:24px;">ERROR PAGE</span><br />
页面不见了!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
<div style="display:none;" class="mt10" id="feedback_div">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject, :id=>"subject", :style => "width: 570px;", :class => "feedbackText mb5", :placeholder => "请在此输入平台的问题和建议您也可以通过QQ留言谢谢" %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_grey fl">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" onclick="$('#new_memo').submit();">&nbsp;&nbsp;</a>
<a href="javascript:void(0);" class="sy_btn_grey_mini f12 fr mr10" onclick="$('#feedback_div').hide();">&nbsp;&nbsp;</a>
<div class="cl"></div>
<% end %>
</div>
</div>
</div>
</body>
</html>

View File

@ -120,7 +120,7 @@
<% if @course.course_groups.empty? %>
<%=member.course_group_id == 0 ? "暂无" : member.course_group.name %>
<% else %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id, :group_id => @group && @group != -1 ? @group.id : -1},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id, :group_id => @group && @group != -1 ? @group.id : (@group && @group == -1 ? -1 : 0)},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<div class="select-class-option">
<span class="hidden" style="display:inline-block; vertical-align:middle; max-width:70px;"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
<a href="javascript:void(0)" class="sy_icons_edit pic_edit_icon fr mt9 options_show_or_hide" alt="编辑" style="background-position:0 5px;"></a>

View File

@ -1,3 +1,4 @@
hideModal();
<% if object_id && @state != 6%>
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(course, user)) %>");
<% end %>

View File

@ -0,0 +1,23 @@
<% if params[:type] == "0" %>
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>已归档</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="click_OK();">确定</a></div></div></div>';
<% else %>
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>已恢复</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="click_OK();">确定</a></div></div></div>';
<% end %>
pop_box_new(htmlvalue, 400, 132);
function click_OK(){
hideModal();
<% if params[:source] == "1" %>
window.location.href = "<%=syllabus_courselist_syllabus_path(@syllabus, :list_type => params[:type].to_i) %>";
<% elsif params[:source] == "0" %>
<% if params[:type] == "0" %>
window.location.href = "<%=user_courselist_user_path(User.current) %>";
<% else %>
window.location.href = "<%=user_archive_courses_users_path() %>";
<% end %>
<% end %>
}

View File

@ -1,52 +1,87 @@
<% if @object_id && @state != 6 && @state !=4 %>
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>");
<% end %>
<%# if @object_id && @state != 6 && @state !=4 %>
//$("#join_in_course_header").html("<%#= escape_javascript(join_in_course_header(@course, @user)) %>");
<%# end %>
<% if @state %>
<% if @state == 0 %>
alert("加入成功");
hideModal();
$("#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= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">加入成功</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 1 %>
alert("密码错误");
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">密码错误</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 2 %>
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">班级已过期<br/>请联系班级管理员重启班级。(在配置班级处)</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 3 %>
alert("您已经加入了班级");
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经加入了班级</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 4 %>
alert("您输入的邀请码错误");
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您输入的邀请码错误</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 5 %>
alert("您还未登录");
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您还未登录</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 6 %>
alert("申请成功,请等待审核");
hidden_join_course_form();
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 7%>
alert("您已经发送过申请了,请耐心等待");
hidden_join_course_form();
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 8%>
alert("您已经是该班级的教师了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教师了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 9%>
alert("您已经是该班级的教辅了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教辅了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 10%>
alert("您已经是该班级的管理员了");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的管理员了</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 11%>
alert("该班级已被删除");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">该班级已被删除</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 12 %>
alert("您已经发送过申请了,请耐心等待");
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 13 %>
alert("申请成功,请等待审核");
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% else %>
alert("未知错误,请稍后再试");
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">未知错误,请稍后再试</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% end %>
<% end %>
function refresh_current_course(){
hideModal();
<% if @course %>
window.location.href= "<%=course_path(@course.id) %>";
<% end %>
}

View File

@ -4,7 +4,7 @@
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
<% if User.current.allowed_to?(:as_teacher,@course) %>
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
<%=link_to "成员管理", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member', :class => 'hw_more_li' %>
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member'}, :class => 'hw_more_li' %>
</span>
<% end %>
</div>
@ -13,21 +13,12 @@
<% else %>
<div class="sy_class_r sy_class_nobg fr ml10">
<div class="sy_class_r_head mb10">
<h3><%= @subPage_title %></h3>
<div class="hw_more_box">
<ul>
<li class="hw_more_icons">
<ul class="hw_more_txt">
<li><%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'hw_more_li'%></li>
<% if User.current.allowed_to?(:as_teacher,@course) %>
<li>
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'hw_more_li' %>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
<h3 class="fl"><%= @subPage_title %></h3>
<% if User.current.allowed_to?(:as_teacher,@course) %>
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'link-blue ml10 fr mt5' %>
<% end %>
<%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'link-blue fr mt5'%>
<div class="cl"></div>
</div>
<%= render :partial => 'course_student', :locals => {:members => @members} %>
</div>

View File

@ -9,7 +9,7 @@
<% if @syllabus.nil? %>
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input w300 h28"} %>
<% else %>
<span><%=@syllabus.title %></span>
<span id="course_syllabus_title"><%=@syllabus.title %></span>
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
<% end %>
<div class="cl"></div>

View File

@ -1,8 +1,13 @@
<% if @group %>
$("#member_li_<%=@member.id %>").html("");
<% if params[:group_id] != "0" %>
var all_indexes = $("#member_li_<%=@member.id %>").nextAll().find("td:first-child");
for(var i = 0; i < all_indexes.length; i++){
$(all_indexes[i]).html(parseInt($(all_indexes[i]).html()) - 1);
}
$("#member_li_<%=@member.id %>").remove();
<% end %>
<% if @group && @group != "-1" %>
//$("#member_content").html("<%#= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>");
$("#join_or_add").html("<%= escape_javascript( render :partial => 'join_or_add')%>");
<% else %>
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
<% end %>
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>");

View File

@ -0,0 +1,30 @@
<table class="newupload_table" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th class="newupload_td01">&nbsp;</th>
<th class="pr">
<%= link_to "试卷标题", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :remote => true%>
<% if order == "exercise_name" %>
<%= link_to "", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'}", :style => "position: absolute; top: 8px; left: 172px;", :remote => true %>
<% end %>
</th>
<th class="newupload_td03" style="color: #7f7f7f;">来源</th>
<th class="newupload_td04 pr">
<%= link_to "创建时间", search_exercises_exercise_index_path(:course_id => course_id, :order => "created_at", :sort => @r_sort), :remote => true%>
<% if order == "created_at" %>
<%= link_to "", search_exercises_exercise_index_path(:course_id => course_id, :order => "created_at", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'}", :style => "position: absolute; top: 8px; left: 75px;", :remote => true %>
<% end %>
</th>
</tr>
</thead>
<tbody>
<% exercises.each do |exercise| %>
<tr class="">
<td class="newupload_td01"><input type="checkbox" name="exercise_id[]" value="<%=exercise.id %>"/></td>
<td class="newupload_td02"><p><%=exercise.exercise_name %></p></td>
<td class="newupload_td02"><p><%=exercise.course.name %></p></td>
<td class="newupload_td04"><%=format_date(exercise.created_at) %></td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -1,74 +1,101 @@
<%# has_commit = has_commit_poll?(poll.id ,User.current)%>
<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%>
<% if @is_teacher%>
<li title="<%= exercise.exercise_name %>">
<div style="width: 310px;float: left;">
<%# if has_commit %>
<%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
<%# else %>
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
<%# end %>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
<div>
<div title="<%= exercise.exercise_name %>">
<div style="width: 500px;float: left;">
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue mw450", :title => "#{exercise_name}" %>
<% if exercise.exercise_status == 1 %>
<span class="exercise_status_nop fl mt3"></span>
<% elsif exercise.exercise_status == 2 %>
<span class="exercise_status_pub fl mt3"></span>
<% else %>
<span class="exercise_status_end fl mt3"></span>
<% end%>
</div>
</div>
<% if exercise.exercise_status == 1 %>
<% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %>
<div><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></div>
<% elsif exercise.exercise_status == 2%>
<div><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></div>
<% else%>
<div class="pollsbtn fr mr10 pollsbtn_grey ml5">发布试卷</div>
<% end%>
<% if exercise.exercise_status == 1%>
<div class="pollsbtn fr mr10 pollsbtn_grey">统计结果</div>
<% else %>
<div><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></div>
<% end%>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
<% if @is_teacher && exercise.exercise_status > 1 %>
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
<% end %>
<div id="exercise_opr_<%=exercise.id %>" class="none fr">
<a href="javascript:void(0)" onClick="delete_exercise(<%=exercise.id %>);" title="删除试卷" class="ex_icon_de mt0"></a>
<% if exercise.exercise_status == 1 %>
<%= link_to '', edit_exercise_path(exercise.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%>
<% end%>
</div>
</li>
<%# if exercise.exercise_status == 2 %>
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
<%# else %>
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
<%# end%>
<%# if exercise.exercise_status == 1%>
<!--<li class="polls_de_grey fr ml5">导出</li>-->
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
<%# end%>
<% if exercise.exercise_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
<% elsif exercise.exercise_status == 2%>
<li><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></li>
<% else%>
<li class="pollsbtn fr mr10 pollsbtn_grey ml5">发布试卷</li>
<% end%>
<% if exercise.exercise_status == 1%>
<li class="pollsbtn fr mr10 pollsbtn_grey">统计结果</li>
<% else %>
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
<% end%>
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
<% if exercise.exercise_status == 1 %>
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml10"%></li>
<li class="polls_date fr"><%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%></li>
<% elsif exercise.exercise_status == 2 %>
<li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
<li class="polls_date fr">已发布</li>
<% else %>
<li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
<li class="polls_date fr">已截止</li>
<% end%>
<div class="clear"></div>
</div>
<% else%>
<% if exercise.exercise_status != 1%>
<%# if has_commit%>
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
<li class="pollsbtn_tip fl ml5">已答</li-->
<%#else%>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
<% eu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise.id, User.current.id, true).first %>
<% if exercise.end_time <= Time.now && eu && exercise.end_time >= eu.created_at %>
<li class="pollsbtn_tip fl ml5">已答</li>
<% end %>
<%#end%>
<div>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :title => "#{exercise_name}", :class => "polls_title polls_title_st fl c_dblue "%>
<% if exercise.exercise_status == 1 %>
<span class="exercise_status_nop fl"></span>
<% elsif exercise.exercise_status == 2 %>
<span class="exercise_status_pub fl"></span>
<% else %>
<span class="exercise_status_end fl"></span>
<% end%>
<% if eu && exercise.end_time >= eu.created_at %>
<span class="exercise_status_com fl ml5"></span>
<% else %>
<span class="exercise_status_nocom fl ml5"></span>
<% end %>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
<% exercise_end = exercise.end_time > Time.now
if exercise.time == -1 || exercise.time.nil?
can_edit_excercise = exercise_end
else
can_edit_excercise = !has_commit_exercise?(exercise.id,User.current.id)&& exercise_end
end%>
<% if can_edit_excercise && eu %>
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">继续答题</a>
<% elsif can_edit_excercise %>
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">开始答题</a>
<% else %>
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">查看答题</a>
<% end %>
<% if exercise.show_result == 1 %>
<% if exercise.end_time <= Time.now %>
<%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%>
<% else %>
<div class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间还未到,暂不可查看统计结果">统计结果</div>
<%end%>
<% end %>
<div class="clear"></div>
</div>
<% end%>
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>
<% if exercise.show_result == 1 %>
<% if exercise.end_time <= Time.now %>
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
<% else %>
<li class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间未到,暂不能查看统计结果">统计结果</li>
<%end%>
<% end %>
<% end%>

View File

@ -3,15 +3,15 @@
<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 "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
<%= link_to "导入试卷", other_exercise_exercise_index_path(:course_id => @course.id), :remote=>true,:class => "newbtn"%>
<% end%>
</div>
<div class="cl"></div>
<div id="polls_list" class="polls_list">
<% @exercises.each_with_index do |exercise,index|%>
<ul id="exercises_<%= exercise.id %>" class="polls_list_ul">
<ul id="exercises_<%= exercise.id %>" class="exercise_list_div" onmouseover="$('#exercise_opr_<%=exercise.id %>').show();" onmouseout="$('#exercise_opr_<%=exercise.id %>').hide();">
<%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %>
</ul>
<div class="cl"></div>

View File

@ -0,0 +1,81 @@
<div id="muban_popup_box" style="width:745px;">
<div class="muban_popup_top">
<h3 class="fl">选择试卷导入本班级</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con">
<div class="newupload_conbox">
<div class="newupload_search_box mb10">
<input class="newupload_search_input" placeholder="输入试卷标题的关键词进行搜索" name="search" type="text">
<a href="javascript:void(0);" class="newupload_btn_search"></a>
</div>
</div>
<%=form_tag import_other_exercise_exercise_index_path,
method: :post,
remote: true,
id: "import_other_exercise_form" do %>
<input type="hidden" name="course_id" value="<%= course_id%>" />
<div class="ml15">
<div id="all_import_exercises">
<%=render :partial => 'all_import_exercises', :locals => {:exercises => exercises, :course_id => course_id, :order => @order} %>
</div>
<div class="clear">
<p class="none c_red" id="choose_exercise_notice"></p>
<div class="clear fl mt10">
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="submit_import_form();">确定</a>
<a href="javascript:void(0)" class="btn fr mr5" onclick="hideModal();">取消</a>
</div>
<div class="fr mr10">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="exercise_ref_pages">
<%= pagination_links_full @ex_pages, @ex_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
<script>
function submit_import_form(){
var checkboxs = $("input[name='exercise_id[]']:checked");
if(checkboxs.length > 0) {
$("#choose_exercise_notice").html("");
$('#import_other_exercise_form').submit();
hideModal();
} else{
$("#choose_exercise_notice").html("请至少选择一个试卷");
$("#choose_exercise_notice").show();
}
}
var lastSearchCondition = '';
var count = 0;
function search_exs(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'exercise', :action => 'search_exercises') %>'+'?name='+ e.target.value+'&course_id=<%=course_id %>',
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询项目
$("input[name='search']").on('input', function (e) {
throttle(search_exs,window,e);
});
</script>

View File

@ -11,8 +11,6 @@
<span>测验时长:<%= exercise.time %>分钟</span>
<% end %>
</div>
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;">
<%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
</pre>
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
<div class="cl"></div>
</div>

View File

@ -23,9 +23,9 @@
<td class="hworkStName130 pr10 student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
<%=exercise.user.show_name %>
</td>
<td class="hworkStID130 pr10 student_work_<%= exercise.id%> float-none" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
<span class="hidden fl" style="width:130px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
</td>
<td class="hworkStID130 pr10 student_work_<%= exercise.id%> float-none" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
<span class="hidden fl" style="width:130px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
</td>
<td class="hworkStID130 student_work_<%= exercise.id%> float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
--
</td>
@ -33,7 +33,7 @@
<td class="hworkList130 c_grey">
<% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if @exercise.end_time <= exercise.created_at %>
<% if exercise.commit_status == 0 %>
<span class="c_red">[未答]</span>
<% end %>
<% end %>

View File

@ -1 +1,2 @@
hideModal();
$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>");

View File

@ -0,0 +1,9 @@
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>试卷已导入<br/>但需要您设置发布时间和截止时间,以激活相应的试卷<br/></p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="click_OK();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
function click_OK(){
hideModal();
window.location.href = "<%= exercise_index_path(:course_id => @course.id) %>";
}

View File

@ -5,31 +5,16 @@
});
function republish_exercise(exercise_id,index)
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>取消发布后学生答题将会被清空<br />是否确定取消发布该测验?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/exercise/"+ exercise_id +"/republish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
"</div>" +
"</div>" +
"</div>");
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消发布后学生答题将会被清空<br />是否确定取消发布该试卷?</p>' +
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a>' +
'<a href="/exercise/'+ exercise_id +'/republish_exercise?index='+ index +'" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确&nbsp;&nbsp;定</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
}
function clickCanel(){hideModal("#popbox02");}
function exercise_submit(exercise_id,exercise_name,index)
function exercise_submit(status, exercise_id,exercise_name,index)
{
if(exercise_name == 0)
{
@ -37,29 +22,31 @@
}
else
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>测验发布后将不能对测验进行修改,<br />是否确定发布该测验?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/exercise/"+ exercise_id +"/publish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
"</div>" +
"</div>" +
"</div>");
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
if (status == 1){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您还没有设置截止时间,请先设置截止时间再发布</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
} else if(status == 2){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您设置的截止时间已过期,请重新设置</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
} else{
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>发布后不能再对试卷进行修改<br/>是否确定发布</p>' +
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a>' +
'<a href="/exercise/'+ exercise_id +'/publish_exercise?index='+ index +'" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确&nbsp;&nbsp;定</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
}
}
}
function delete_exercise(id){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您是否确定删除</p><div class="cl"></div><a href="/exercise/'+ id +'" class="fr sy_btn_blue mr90 mt10" data-method="delete" data-remote="true">确定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
</script>
<div class="courseRSide fl" id="homework_page_right">
<div class="polls_content02" id="exercise" style="width: 730px;">

View File

@ -0,0 +1,8 @@
<% if @exercises.blank? %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您的其它班级下没有试卷可供导入</p><div class="cl"></div><a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 122px;" onclick="hideModal();">确定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% else %>
var html_value = '<%= escape_javascript(render :partial => 'other_exercises',:locals => {:exercises => @exercises, :course_id=>@course_id}) %>';
pop_box_new(html_value, 745, 600);
<% end %>

View File

@ -1,10 +1,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','111px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form");
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>发布成功</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);

View File

@ -1,10 +1,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','80px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form");
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消成功</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);

View File

@ -0,0 +1,3 @@
$("#all_import_exercises").html('<%= escape_javascript(render :partial => 'all_import_exercises', :locals => {:exercises => @exercises, :course_id => @course_id, :order => @order})%>');
$("#exercise_ref_pages").html('<%= pagination_links_full @ex_pages, @ex_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
$("#choose_exercise_notice").html("");

View File

@ -12,6 +12,8 @@
$("#homework_end_time_span").text("");
$("#homework_course_id_span").text("");
$("#homework_editor").toggle();
//$("#select_type_nitice").show();
document.getElementById("homework_type_option").options[0].selected = true;
}
$(function(){

View File

@ -98,8 +98,8 @@
<li class=" clear" style="border:1px solid #c8c8c8;">
<% if @issue.safe_attribute? 'start_date' %>
<%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('start_date'), :onchange=>"issue_start_date_change();",
:class=>"fl calendar_input", :style=>"width:170px;" %>
:required => @issue.required_attribute?('start_date'), :onchange => "issue_start_date_change();",
:class => "fl calendar_input", :style => "width:170px;" %>
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
@ -110,8 +110,8 @@
<label class="label02" ></label>
<% if @issue.safe_attribute? 'due_date' %>
<%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('due_date'), :onchange=>"issue_end_date_change();",
:class=>"fl calendar_input",:style=>"width: 170px;", :placeholder=> "请选择结束日期" %>
:required => @issue.required_attribute?('due_date'), :onchange => "issue_end_date_change();",
:class => "fl calendar_input",:style => "width: 170px;", :placeholder => "请选择结束日期" %>
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
@ -121,7 +121,7 @@
<li class=" clear">
<% if @issue.safe_attribute? 'estimated_hours' %>
<%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('estimated_hours'), :placeholder=> "请填写预计工时" %>
:required => @issue.required_attribute?('estimated_hours'), :placeholder => "请填写预计工时" %>
<% end %>
</li>
<li class=" clear"><%= l(:field_estimated_hours) %></li>
@ -160,9 +160,5 @@
}
// 里程碑添加默认选项
$("#issue_fixed_version_id option[value='']").remove();
<% if params[:action] == "new" %>
$('#issue_fixed_version_id').prepend("<option value='0' selected='selected'>选择里程碑</option>")
<% else %>
$('#issue_fixed_version_id').prepend("<option value='0'>选择里程碑</option>")
<% end %>
</script>

View File

@ -11,7 +11,7 @@
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
<%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'Issue', :user_activity_id => issue.id}%>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<% if comment.details.any? %>

View File

@ -69,13 +69,13 @@
<li class="<%= (activity.done_ratio == 100 ? 'c_green issues_list_min mr5' : 'c_red issues_list_min mr5') %>"><%= activity.done_ratio %>%</li>
<li class="issues_list_min">
<% if activity.journals.count > 0 %>
<span class="issues_icons_mes fl mr5"></span>
<span class="issues_icons_mes fl mr5" style="margin-top:15px;" ></span>
<span class="fl mr5"><%= activity.journals.count %></span>
<% end %>
<div class="undis" style="position: absolute; <%= activity.journals.count > 0 ? 'top:25px;' : 'top:0px' %>">
<%= link_to "", issue_path(activity.id, :edit => 'true'), :class => 'sy_icons_edit fl mt15', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
<div class="undis" style="position: absolute; <%= activity.journals.count > 0 ? 'top:25px;' : 'top:7px' %>">
<%= link_to "", issue_path(activity.id, :edit => 'true'), :class => 'sy_icons_edit fl mt15', :style => "margin-top:25px;", :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
<% if !defined?(project_id) && !defined?(user_id) %>
<%= link_to "", issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %>
<%= link_to "", issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15', :style => "margin-top:25px;" if User.current.allowed_to?(:delete_issues, activity.project) %>
<% elsif defined?(project_id) %>
<%= link_to "", issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %>
<% elsif defined?(user_id) %>

View File

@ -12,7 +12,7 @@
<%= link_to "打开<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@issue_open_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %>
</li>
<li id="new_roadmap_nav_3" onclick="HoverLi(3);">
<%= link_to "锁定<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
<%= link_to "关闭<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
</li>
</ul>
</div><!--issues_statistics end-->

View File

@ -11,9 +11,18 @@
</tr>
</thead>
<tbody>
<tr>
<td class="hidden dis p10" style="width:166px;">合计</td>
<td class="w130"><%= @alltotal[0] %></td>
<td class="w130"><%= @alltotal[2] %></td>
<td class="w130"><%= @alltotal[4] %></td>
<td class="w130"><%= @alltotal[1] %></td>
<td class="w130"><%= @alltotal[3] %></td>
<td class="w130"><%= @alltotal[5] %></td>
</tr>
<% @results.each do |k,v|%>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] =="Anonymous" ? "未指派" : v[:name] %></td>
<td class="w130"><%= v[0] %></td>
<td class="w130"><%= v[2] %></td>
<td class="w130"><%= v[4] %></td>
@ -22,14 +31,5 @@
<td class="w130"><%= v[5] %></td>
</tr>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @alltotal[0] %></td>
<td class="w130"><%= @alltotal[2] %></td>
<td class="w130"><%= @alltotal[4] %></td>
<td class="w130"><%= @alltotal[1] %></td>
<td class="w130"><%= @alltotal[3] %></td>
<td class="w130"><%= @alltotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -11,10 +11,19 @@
</tr>
</thead>
<tbody>
<tr>
<td class="hidden dis p10" style="width:166px;">合计</td>
<td class="w130"><%= @closetotal[0] %></td>
<td class="w130"><%= @closetotal[2] %></td>
<td class="w130"><%= @closetotal[4] %></td>
<td class="w130"><%= @closetotal[1] %></td>
<td class="w130"><%= @closetotal[3] %></td>
<td class="w130"><%= @closetotal[5] %></td>
</tr>
<% @results.each do |k,v|%>
<% if v[12] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] == "Anonymous" ? "未指派" : v[:name] %></td>
<td class="w130"><%= v[12] %></td>
<td class="w130"><%= v[14] %></td>
<td class="w130"><%= v[16] %></td>
@ -24,14 +33,5 @@
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @closetotal[0] %></td>
<td class="w130"><%= @closetotal[2] %></td>
<td class="w130"><%= @closetotal[4] %></td>
<td class="w130"><%= @closetotal[1] %></td>
<td class="w130"><%= @closetotal[3] %></td>
<td class="w130"><%= @closetotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -11,10 +11,19 @@
</tr>
</thead>
<tbody>
<tr>
<td class="hidden dis p10" style="width:166px;">合计</td>
<td class="w130"><%= @opentotal[0] %></td>
<td class="w130"><%= @opentotal[2] %></td>
<td class="w130"><%= @opentotal[4] %></td>
<td class="w130"><%= @opentotal[1] %></td>
<td class="w130"><%= @opentotal[3] %></td>
<td class="w130"><%= @opentotal[5] %></td>
</tr>
<% @results.each do |k,v|%>
<% if v[6] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] =="Anonymous" ? "未指派" : v[:name] %></td>
<td class="w130"><%= v[6] %></td>
<td class="w130"><%= v[8] %></td>
<td class="w130"><%= v[10] %></td>
@ -24,14 +33,5 @@
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @opentotal[0] %></td>
<td class="w130"><%= @opentotal[2] %></td>
<td class="w130"><%= @opentotal[4] %></td>
<td class="w130"><%= @opentotal[1] %></td>
<td class="w130"><%= @opentotal[3] %></td>
<td class="w130"><%= @opentotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -20,8 +20,8 @@
<div class="cl"></div>
<% unless @project.forked_from_project_id.nil? %>
<div class="fl pro_new_name ml15 clear mt5">
<span class="vl_fork fl mr5 mt2">forked from</span> <%=link_to "#{get_fork_from_project(@project.forked_from_project_id).owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(get_fork_from_project(@project.forked_from_project_id).owner), :class => "pro_new_username_fork fl" %>
<%=link_to get_fork_from_project(@project.forked_from_project_id).name, project_path(get_fork_from_project(@project.forked_from_project_id)), :class => "pro_new_username_fork fl" %>
<span class="vl_fork fl mr5 mt2">forked from</span> <%=link_to "#{get_fork_from_project(@project.forked_from_project_id).owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(get_fork_from_project(@project.forked_from_project_id).owner), :class => "pro_new_username_fork fl", :target => "_blank" %>
<%=link_to get_fork_from_project(@project.forked_from_project_id).name, project_path(get_fork_from_project(@project.forked_from_project_id)), :class => "pro_new_username_fork fl", :target => "_blank" %>
</div>
<div class="cl"></div>
<% end %>

View File

@ -26,6 +26,18 @@
</li>
</ul>
</div>
<% elsif User.current.logged? && User.current.member_of_course?(@course) %>
<div class="sy_class_setting" >
<ul>
<li class="sy_class_setting_icon">
<ul class="sy_class_setting_text">
<li>
<a href="javascript:void(0)" onclick="delete_confirm();" class="sy_class_option">退出班级</a>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<div class="cl"></div>
@ -84,7 +96,7 @@
<% elsif is_teacher && is_ST %>
<%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl", :title => "由教师身份切换至学生身份" %>
<% end %>
<% unless (is_teacher || is_TA || is_TE) %>
<% unless (is_teacher || is_TA || is_TE || is_ST) %>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end %>
</div>

View File

@ -276,6 +276,13 @@
$("#expand_tools_expand a").addClass('active');
$("#navContentCourse").toggle();
});
function delete_confirm(){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div><a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确&nbsp;&nbsp;定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
</script>
</html>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public',:media => 'all'%>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public','css/moduel',:media => 'all'%>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%>

View File

@ -140,25 +140,25 @@
<div class="subNavBox ">
<div class="subNav ">
<a href="<%=url_for(:controller => 'users', :action => 'show',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'show',:id=>@user)%>" class=" f14 c_blue02">
动态
</a>
</div>
<% if @center_flag %>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_courselist',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_courselist',:id=>@user)%>" class=" f14 c_blue02">
我的课程
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.count%>)</span>
</a>
</div>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_projectlist',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_projectlist',:id=>@user)%>" 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 => 'users', :action => 'user_resource',:id=>@user.id,:type=>1)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_resource',:id=>@user,:type=>1)%>" class=" f14 c_blue02">
我的资源库
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=Attachment.where("(author_id = #{@user.id} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) or (container_type = 'Course' and container_id in (#{@user.courses.map{|c| c.id}.empty? ? '0' : @user.courses.map{|c| c.id}.join(',')}))").count%>)</span>
</a>
@ -166,13 +166,13 @@
<% else%>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_courselist',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_courselist',:id=>@user)%>" 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_projectlist',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_projectlist',:id=>@user)%>" class=" f14 c_blue02">
TA的项目
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.visible.count%>)</span>
</a>

View File

@ -148,7 +148,7 @@
<li>
<a href="<%=user_fanslist_user_path(@user) %>">
<strong>粉丝</strong><br />
<span class="sy_cgrey"><%= @user.watcher_users.count %></span>
<span id="user_fans_number" class="sy_cgrey"><%= @user.watcher_users.count %></span>
</a>
</li>
</ul>
@ -162,8 +162,8 @@
<% if hidden_unproject_infos %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user.id}, :style => "color:#aaa;" %></font>
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list" %>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
<%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
@ -181,7 +181,7 @@
</li>
<% if @user == User.current %>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我的作业', my_homeworks_user_path(@user.id), :target => "_blank", :style => "font-size:14px;" %>
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<% end %>
<% end %>
@ -190,8 +190,8 @@
<ul class="users_accordion mb10">
<li id="user_06" class="user_icons_project">
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :style => "color:#aaa;" %></font>
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list'%>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_projectlist", :id => @user}, :style => "color:#aaa;" %></font>
<% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
<div class="<%= projects.empty? ? 'none' : ''%>" id="homepage_left_project_list">
<%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify','css/project', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min",'prettify' %>

View File

@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<%= render :partial => 'users/message_contents', :locals => {:comment => reply, :type => 'Message', :user_activity_id => @topic.id}%>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
@ -49,7 +49,7 @@
<div class="cl"></div>
</div>
<% end %>
<% if @reply_count > @page * @limit + 10 %>
<% if @limit_count > @page * @limit + 10 %>
<div id="more_message_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>

View File

@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33, :height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<%= render :partial => 'users/message_contents', :locals => {:comment => reply} %>
<%= render :partial => 'users/message_contents', :locals => {:comment => reply, :type => 'Message', :user_activity_id => @topic.id} %>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe %>
@ -48,7 +48,7 @@
<div class="cl"></div>
</div>
<% end %>
<% if @reply_count > @page * @limit + 10 %>
<% if @limit_count > @page * @limit + 10 %>
<div id="more_message_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>

View File

@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="reply-content ml15" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
<%= render :partial => 'projects/project_message_contents', :locals => {:comment => reply}%>
<%= render :partial => 'projects/project_message_contents', :locals => {:comment => reply, :user_activity_id => @topic.id}%>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
@ -49,7 +49,7 @@
<div class="cl"></div>
</div>
<% end %>
<% if @reply_count > @page * @limit + 10 %>
<% if @limit_count > @page * @limit + 10 %>
<div id="more_message_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>

View File

@ -2,12 +2,12 @@
<% if params[:is_project] %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/act_messages', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% end %>
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% elsif @org_subfield %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");

View File

@ -2,12 +2,12 @@
<% if params[:is_project] %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/act_messages', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% end %>
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% elsif @org_subfield %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");

View File

@ -106,7 +106,7 @@
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text"value="<%= User.current.user_extensions.school %>" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.school.id %>" /> <!-- 单位名称的test框选中下拉列表框的id -->
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.school.try(:id) %>" /> <!-- 单位名称的test框选中下拉列表框的id -->
<% end %>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
@ -214,7 +214,8 @@
<li>确认密码&nbsp;:&nbsp;</li>
</ul>
<ul class="setting_right ">
<li><input id="password" name="password" class="w210" type="password" required="true" nh_required="1"></li>
<input style="display:none;">
<li><input id="password" name="password" autocomplete="off" class="w210" type="password" required="true" nh_required="1"></li>
<li><input id="new_password" name="new_password" class="w210" type="password" required="true" nh_required="1"><span class="c_red ml5">请输入8-12个字符</span></li>
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true" nh_required="1"></li>
<li class="ml2">

View File

@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
<%= render :partial => 'users/news_contents', :locals => {:comment => comment, :type => 'News', :user_activity_id => @news.id}%>
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
@ -52,7 +52,7 @@
<div class="cl"></div>
</li>
<% end %>
<% if @comments_count > @page * @limit + 10 %>
<% if @limit_count > @page * @limit + 10 %>
<div id="more_news_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>

View File

@ -11,7 +11,7 @@
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<%= render :partial => 'users/message_contents', :locals => {:comment => comment, :type => 'OrgDocumentComment', :user_activity_id => @document.id}%>
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
@ -53,7 +53,7 @@
</li>
<% end %>
</div>
<% if @reply_count > @page * @limit + 10 %>
<% if @limit_count > @page * @limit + 10 %>
<div id="more_document_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>

View File

@ -1,6 +1,6 @@
//location.reload();
<% if @act %>
$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => 2, :act => @act}) %>");
$("#activity_post_reply_<%= @act.id %>").html("<%= escape_javascript(render :partial => 'organizations/org_document_post_reply', :locals => {:activity => @document, :user_activity_id => @act.id}) %>");
sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");
<% elsif params[:detail_page] %>
window.location.href = '<%= organization_path(params[:organization_id],:org_subfield_id => @org_sub_id )%>';

View File

@ -1,4 +1,4 @@
<% if @user_activity_id %>
$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => 2, :act => @act}) %>");
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'organizations/org_document_post_reply', :locals => {:activity => @document, :user_activity_id => @user_activity_id}) %>");
<% end %>
sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");

View File

@ -74,9 +74,6 @@
<% end %>
</div>
</div>
<% all_comments = []%>
<% all_replies = OrgDocumentComment.where("root_id = #{@document.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
<%# if count > 0 %>
@ -89,7 +86,6 @@
</div>
</div>
<%# comments = all_replies %>
<div class="" id="reply_div_<%= @document.id %>">
<%= render :partial => "document_show_replies" %>
</div>

View File

@ -0,0 +1,33 @@
<% all_replies = OrgDocumentComment.where("root_id = #{activity.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<% no_children_comments = get_no_children_comments all_replies %>
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :expand_more =>no_children_comments[:three_more]} %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => no_children_comments[:no_children_comments], :user_activity_id => user_activity_id, :type => 'OrgDocumentComment', :activity_id =>activity.id}%>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id %>">
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %>
</div>
<div class="homepagePostReplyInputContainer">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id %>' style="display:none;">
<%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => activity.id, :act_id => user_activity_id, :flag => 2), :method => "post", :remote => true) do |f| %>
<div nhname='toolbar_container_<%= user_activity_id %>'></div>
<textarea placeholder="有问题或建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id %>' name="org_content"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id %>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;line-height:18px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id %>'></p>
<% end %>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
</div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,35 @@
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<% no_children_comments = get_no_children_comments all_replies %>
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :expand_more =>no_children_comments[:three_more]} %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => no_children_comments[:no_children_comments], :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id}%>
</div>
<% end %>
<% if !activity.locked? && authorize_for_course('messages', 'reply') %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
<div class="cl"></div>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>

View File

@ -69,42 +69,11 @@
</div>
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = OrgDocumentComment.where("root_id = #{activity.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => 0, :is_board =>0}%>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id,:is_course => 0, :is_board => 0},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div id="activity_post_reply_<%=user_activity_id %>">
<%=render :partial => 'organizations/org_message_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -55,37 +55,10 @@
</div>
<div class="cl"></div>
</div>
<% count=activity.comments.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<% comments = activity.comments.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/news_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'News', :activity_id => activity.id} %>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div id="activity_post_reply_<%=user_activity_id %>">
<%=render :partial => 'users/course_news_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
</div>

View File

@ -67,41 +67,10 @@
<% end %>
</div>
</div>
<% all_comments = []%>
<% all_replies = OrgDocumentComment.where("root_id = #{document.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => document, :user_activity_id => act.id} %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= act.id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => act.id, :type => 'OrgDocumentComment', :activity_id =>document.id}%>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= act.id %>">
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %>
</div>
<div class="homepagePostReplyInputContainer">
<% if User.current.logged? %>
<div nhname='new_message_<%= act.id %>' style="display:none;">
<%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
<div nhname='toolbar_container_<%= act.id %>'></div>
<textarea placeholder="有问题或建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= act.id %>' name="org_content"></textarea>
<a id="new_message_submit_btn_<%= act.id %>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;line-height:18px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= act.id %>'></p>
<% end %>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
</div>
<div class="cl"></div>
<div id="activity_post_reply_<%=act.id %>">
<%=render :partial => 'organizations/org_document_post_reply', :locals => {:activity => document, :user_activity_id => act.id} %>
</div>
<div class="cl"></div>
</div>

View File

@ -1,14 +1,8 @@
<% if @polls.empty? %>
alert('您的其它班级下没有问卷可供导入');
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您的其它班级下没有问卷可供导入</p><div class="cl"></div><a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 122px;" onclick="hideModal();">确定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% else %>
var html_value = '<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>';
pop_box_new(html_value, 510, 550);
// $('#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","").css("border","3px solid #269ac9");
// $('#ajax-modal').parent().addClass("popbox_polls");
<% end %>

View File

@ -81,45 +81,11 @@
</div>
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% count = all_replies.count %>
<%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
<%# count = fetch_user_leaveWord_reply(activity).count %>
<div class="container-big-grey">
<%= render :partial => 'projects/project_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'projects/project_message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => is_course, :is_board =>is_board}%>
</div>
<% end %>
<% if !activity.locked? %>
<div class="reply-container ml15 borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="reply-content mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id,:is_course => is_course, :is_board => 'true', :is_project => true},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "projects/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div id="activity_post_reply_<%=user_activity_id %>">
<%=render :partial => 'projects/project_message_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -3,7 +3,8 @@
<!--关注项目-->
<li class="mr5 fl">
<%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id},:id=>"fans_num", :class => 'pro_new_topbtn fl' %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li>
<!--加入项目-->
<li class="mr5 fl">
@ -12,15 +13,21 @@
<% else %>
<a style="cursor: default" class="pro_new_topbtn_left fl">等待审批</a>
<% end %>
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员" %>
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %>
</li>
<% end %>
<% else %>
<!--项目创建者不能退出项目-->
<% if User.current.id != @project.user_id %>
<% if User.current.login? %>
<li class="mr5 fl">
<a class="pro_new_topbtn_left fl "> 已加入</a>
<a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>
<%= watcher_link_for_project(@project, User.current) %>
<%= link_to "#{@project.watcher_users.count}", {:controller => "projects", :action => "project_watcherlist",
:id => @project.id}, :id => "fans_num", :class => 'pro_new_topbtn fl', :title => "关注成员列表" %>
</li>
<li class="mr5 fl">
<a class="pro_new_topbtn_left fl " style="cursor:default;"> 已加入</a>
<!-- <a href="<%= project_member_path(@project) %>" class=" pro_new_topbtn fl"><%= Member.where(:project_id => @project.id).count %></a>-->
<%= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员列表" %>
</li>
<%#= link_to "#{Member.where(:project_id => @project.id).count}", project_member_path(@project), :class => 'pro_new_topbtn fl', :title => "项目成员" %>
<% end %>
@ -35,8 +42,17 @@
<!-- <a href="<%#= {:controller => 'repositories', :action => 'forked'} %>" class="pro_new_topbtn_left fl" target="_blank">Fork</a>-->
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),
:class=>"pro_new_topbtn_left fl", :remote => true %>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl"><%= @project.forked_count.to_i %></a>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
</li>
<% else%>
<li class="mr5 fl">
<%#= link_to "<span class='vl_fork '></span>".html_safe+"Fork","#",
:class=>"pro_new_grey_topbtn_left fl"%>
<a href="javascript:void(0)" class="pro_new_grey_topbtn_left fl" >
<span class='vl_fork'>Fork</span>
</a>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
<% end %>

View File

@ -16,5 +16,25 @@
<%= comment.content_detail.html_safe %>
<% end %>
</div>
<div class="orig_reply mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Message', :user_activity_id => user_activity_id, :parent_id => parent_id, :is_project => true},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup03" style="display: none"> ︿</span>
</span>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
</div>
<div class="cl"></div>

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