Merge branch 'sw_new_course' into szzh

This commit is contained in:
sw 2015-03-27 17:44:29 +08:00
commit fcc4275a36
139 changed files with 3901 additions and 2556 deletions

View File

@ -32,7 +32,7 @@ group :development do
if RUBY_VERSION >= '2.0.0'
gem 'pry-byebug'
else
gem 'pry-debugger'
# gem 'pry-debugger'
end
gem 'pry-stack_explorer'
gem 'better_errors', '~> 1.1.0'

View File

@ -15,7 +15,7 @@ class BidsController < ApplicationController
before_filter :can_show_contest,only: []
#Ended by young
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
:show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
:show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
# added by fq
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
# end
@ -57,8 +57,8 @@ class BidsController < ApplicationController
@offset, @limit = api_offset_and_limit({:limit => 10})
if @project_type == '1'
@bids = Bid.visible.where('reward_type = ?', 3)
# elsif
# @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4)
# elsif
# @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4)
else
@bids = Bid.visible.where('reward_type = ?', 1)
end
@ -71,33 +71,33 @@ class BidsController < ApplicationController
#added by nie
if params[:bid_sort_type].present?
case params[:bid_sort_type]
when '0'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
@s_state = 0
when '1'
unless @offset == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
when '2'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
end
@s_state = 0
when '0'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
@s_state = 0
when '1'
unless @offset == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
when '2'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
end
@s_state = 0
end
else
unless @offset == 0
@ -109,7 +109,7 @@ class BidsController < ApplicationController
end
@s_state = 1
end
#end
#end
end
#huang
def contest
@ -130,33 +130,33 @@ class BidsController < ApplicationController
#added by nie
if params[:contest_sort_type].present?
case params[:contest_sort_type]
when '0'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
@s_state = 0
when '1'
unless @offset == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
when '2'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
end
@s_state = 0
when '0'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
@s_state = 0
when '1'
unless @offset == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
when '2'
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
limit = @limit if limit == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
end
@s_state = 0
end
else
unless @offset == 0
@ -168,7 +168,7 @@ class BidsController < ApplicationController
end
@s_state = 1
end
#end
#end
end
def fork
@ -176,11 +176,12 @@ class BidsController < ApplicationController
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
@membership.each do |membership|
if membership.project.project_type == 1
@courses << membership.project
@courses << membership.project
end
end
end
#将某个企业外包需求选为作业,目前此功能已放弃
def create_fork
@homework = Bid.new
@homework.name = params[:bid][:name]
@ -215,6 +216,7 @@ class BidsController < ApplicationController
end
end
#有两个路由链接到此方法:/bids/:id /calls/:id但是貌似这两个路由都不能访问。。方法作用有待确认
def show
@user = @bid.author
@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@ -229,12 +231,12 @@ class BidsController < ApplicationController
layout_file = ''
case @bid.reward_type
when 3
html_title(l(:label_question_student))
layout_file = 'base_homework'
when 1
layout_file = 'base_bids'
else
layout_file = 'base_contest'
html_title(l(:label_question_student))
layout_file = 'base_homework'
when 1
layout_file = 'base_bids'
else
layout_file = 'base_contest'
end
format.html {
render :layout => layout_file
@ -250,53 +252,44 @@ class BidsController < ApplicationController
else
@state = 1
end
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
# TO_DO
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
end
end
def unjoin_in_contest
joined = JoinInContest.where('bid_id = ? and user_id = ?', @bid.id, User.current.id)
joined.each do |join|
join.delete
end
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
end
end
def new_join
# added by fq
end
# added by bai 增加了参与者和竞赛设置
def show_participator
render :layout => 'base_contest'
end
#配置竞赛
def settings
if @bid.author.id == User.current.id
if @bid.reward_type == 2
@contest = Bid.find_by_reward_type(@bid.reward_type)
render :layout => 'base_contest'
end
else
render_403 :message => :notice_not_contest_setting_authorized
end
if @bid.reward_type == 2
@contest = Bid.find_by_reward_type(@bid.reward_type)
render :layout => 'base_contest'
end
else
render_403 :message => :notice_not_contest_setting_authorized
end
end
#end
# 显示课程
# 显示课程作业,但是好像已经废弃
def show_course
bids = Bid.where('parent_id = ?', @bid.id)
@courses = []
@ -311,12 +304,12 @@ class BidsController < ApplicationController
}
elsif @bid.reward_type == 1
format.html {
render :layout => 'base_bids'
}
render :layout => 'base_bids'
}
else
format.html {
render :layout => 'base_contest'
}
format.html {
render :layout => 'base_contest'
}
end
format.api
@ -337,12 +330,12 @@ class BidsController < ApplicationController
}
elsif @bid.reward_type == 1
format.html {
render :layout => 'base_bids'
}
render :layout => 'base_bids'
}
else
format.html {
render :layout => 'base_contest'
}
format.html {
render :layout => 'base_contest'
}
end
format.api
@ -365,12 +358,12 @@ class BidsController < ApplicationController
}
elsif @bid.reward_type == 1
format.html {
render :layout => 'base_bids'
}
render :layout => 'base_bids'
}
else
format.html {
render :layout => 'base_contest'
}
format.html {
render :layout => 'base_contest'
}
end
format.api
@ -459,9 +452,7 @@ class BidsController < ApplicationController
def show_courseEx
if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?))
# flash[:notice] = ""
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
@user = @bid.author
@bidding_project = @bid.biding_projects.all
@ -569,12 +560,12 @@ class BidsController < ApplicationController
}
elsif @bid.reward_type == 1
format.html {
render :layout => 'base_bids'
}
render :layout => 'base_bids'
}
else
format.html {
render :layout => 'base_contest'
}
format.html {
render :layout => 'base_contest'
}
end
format.api
end
@ -595,7 +586,7 @@ class BidsController < ApplicationController
flash.now[:notice] = l(:label_bidding_contest_succeed)
else @bid.reward_type == 3
flash.now[:notice] = l(:label_bidding_homework_succeed)
flash.now[:notice] = l(:label_bidding_homework_succeed)
end
# end
@ -609,11 +600,11 @@ class BidsController < ApplicationController
end
@bidding_project = @bid.biding_projects
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
# format.html
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
# format.html
format.html { redirect_to :back }
format.js
#format.api { render_api_ok }
#format.api { render_api_ok }
end
end
@ -647,7 +638,7 @@ class BidsController < ApplicationController
@bid.set_commit(@feedback_count)
respond_to do |format|
format.js
#format.api { render_api_ok }
#format.api { render_api_ok }
end
end
@ -674,9 +665,9 @@ class BidsController < ApplicationController
# @message_count = a_message.count
respond_to do |format|
# format.html
# format.html
format.js
#format.api { render_api_ok }
#format.api { render_api_ok }
end
end
@ -689,7 +680,7 @@ class BidsController < ApplicationController
respond_to do |format|
format.html { redirect_to :back }
format.js
#format.api { render_api_ok }
#format.api { render_api_ok }
end
end
@ -698,11 +689,11 @@ class BidsController < ApplicationController
def new
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
if @jour
user = @jour.user
text = @jour.notes
user = @jour.user
text = @jour.notes
else
user = @bid.author
text = @bid.description
user = @bid.author
text = @bid.description
end
# Replaces pre blocks with [...]
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@ -711,7 +702,7 @@ class BidsController < ApplicationController
@id = user.id
rescue ActiveRecord::RecordNotFound
render_404
end
end
##新建需求
def new_bid
@ -743,8 +734,8 @@ class BidsController < ApplicationController
end
end
# added by bai
def update_contest
# added by bai
def update_contest
@bid = Bid.find(params[:id])
@bid.name = params[:bid][:name]
@bid.description = params[:bid][:description]
@ -825,26 +816,26 @@ class BidsController < ApplicationController
@course = Course.find_by_id(params[:course_id])
@course_id = @course.id
#respond_to do |format|
# format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'}
# format.api { render_validation_errors(@bid) }
#end
# format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'}
# format.api { render_validation_errors(@bid) }
#end
render file: 'courses/new_homework', layout: 'base_courses'
end
end
# modify by nwb\
# 编辑作业
def edit
@bid = Bid.find(params[:bid_id])
if (User.current.admin?||User.current.allowed_to?(:as_teacher,@bid.courses.first))
@course_id = params[:course_id]
respond_to do |format|
format.html {
@course = Course.find(params[:course_id])
@user= User.find(User.current.id)
render :layout => 'base_courses'
}
end
def edit
@bid = Bid.find(params[:bid_id])
if (User.current.admin?||User.current.allowed_to?(:as_teacher,@bid.courses.first))
@course_id = params[:course_id]
respond_to do |format|
format.html {
@course = Course.find(params[:course_id])
@user= User.find(User.current.id)
render :layout => 'base_courses'
}
end
else
render_403
end
@ -858,7 +849,7 @@ class BidsController < ApplicationController
@bid.is_evaluation = params[:bid][:is_evaluation]
@bid.proportion = params[:bid][:proportion]
@bid.evaluation_num = params[:bid][:evaluation_num]
@bid.open_anonymous_evaluation = params[:bid][:open_anonymous_evaluation]
params[:bid][:open_anonymous_evaluation] ? @bid.open_anonymous_evaluation = 1 : @bid.open_anonymous_evaluation = 0
@bid.reward_type = 3
@bid.deadline = params[:bid][:deadline]
@bid.budget = 0
@ -888,28 +879,28 @@ class BidsController < ApplicationController
# homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
if hadcommittedhomework(User.current.id, @bid.id) == true
@homework_flag = l(:label_bidding_homework_committed)
@homework_flag = l(:label_bidding_homework_committed)
else
@homework = HomeworkAttach.new
@homework.safe_attributes = params[:homeworkattach]
@homework.bid_id = @bid.id
@homework.user_id = User.current.id
@homework.save_attachments(params[:attachments])
@homework = HomeworkAttach.new
@homework.safe_attributes = params[:homeworkattach]
@homework.bid_id = @bid.id
@homework.user_id = User.current.id
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)
render_attachment_warning_if_needed(@homework)
@homework_flag = if @homework.save
l(:label_bidding_homework_succeed)
else
l(:label_bidding_homework_failed)
end
@homework_flag = if @homework.save
l(:label_bidding_homework_succeed)
else
l(:label_bidding_homework_failed)
end
if @homework.attachments.empty?
@homework.delete
#flash[:error] = l(:no_attachmens_allowed)
@homework_flag = l(:no_attachmens_allowed)
# else
end
if @homework.attachments.empty?
@homework.delete
#flash[:error] = l(:no_attachmens_allowed)
@homework_flag = l(:no_attachmens_allowed)
# else
end
end
end
@ -931,7 +922,7 @@ class BidsController < ApplicationController
@member = []
@course.memberships.each do |member|
unless (member.roles && Role.where('id = ? ', 3)).empty?
@member.push member
@member.push member
end
end
if @bid.homework_type = 1
@ -958,7 +949,7 @@ class BidsController < ApplicationController
respond_to do |format|
format.html { redirect_to :back }
format.js
#format.api { render_api_ok }
#format.api { render_api_ok }
end
end
@ -970,7 +961,7 @@ class BidsController < ApplicationController
respond_to do |format|
format.html { redirect_to :back }
format.js
#format.api { render_api_ok }
#format.api { render_api_ok }
end
end
@ -1031,7 +1022,7 @@ class BidsController < ApplicationController
end
end
def stop_anonymous_comment
def stop_anonymous_comment
@bid = Bid.find(params[:id])
@bid.update_column('comment_status', 2)
@ -1039,7 +1030,7 @@ class BidsController < ApplicationController
respond_to do |format|
format.js
end
end
end
def alert_anonymous_comment
@bid = Bid.find params[:id]

View File

@ -66,15 +66,28 @@ class BoardsController < ApplicationController
'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
@topic_count = @board.topics.count
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC").
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
order(sort_clause).
preload(:author, {:last_reply => :author}).
all
if @project
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC").
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
order(sort_clause).
preload(:author, {:last_reply => :author}).
all
elsif @course
board_topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC").
includes(:last_reply).
# limit(@topic_pages.per_page).
# offset(@topic_pages.offset).
order(sort_clause).
preload(:author, {:last_reply => :author}).
all
@topics = paginateHelper board_topics,10
end
@message = Message.new(:board => @board)
#modify by nwb
if @project

View File

@ -33,28 +33,6 @@ class CoursesController < ApplicationController
join = cs.join_course params,User.current
@state = join[:state]
course = join[:course]
#course = Course.find_by_id params[:object_id]
#if course
# if course_endTime_timeout? course
# @state = 2
# else
# if User.current.member_of_course?(course)
# @state = 3
# else
# if params[:course_password] == course.password
# members = []
# members << Member.new(:role_ids => [10], :user_id => User.current.id)
# course.members << members
# StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id])
# @state = 0
# else
# @state = 1
# end
# end
# end
#else
# @state = 4
#end
else
@state = 5 #未登录
end
@ -71,26 +49,15 @@ class CoursesController < ApplicationController
def unjoin
if User.current.logged?
#
# @member = Member.where('course_id = ? and user_id = ?', params[:object_id], User.current.id)
# @member.first.destroy
#
# joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id])
# joined.each do |join|
# join.delete
# end
cs = CoursesService.new
cs.exit_course params,User.current
end
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Course.find(params[:object_id]), :object_id => params[:object_id]} }
end
end
def join_private_courses
respond_to do |format|
format.js
@ -119,36 +86,6 @@ class CoursesController < ApplicationController
format.api { render_validation_errors(@course) }
end
end
#@course.safe_attributes = params[:course]
#@course.time = params[:time]
#@course.term = params[:term]
#@course.class_period = params[:class_period]
#if @course.save
# if params[:course][:is_public] == '0'
# course_status = CourseStatus.find_by_course_id(@course.id)
# course_status.destroy if course_status
# elsif params[:course][:is_public] == '1'
# course_status = CourseStatus.find_by_course_id(@course.id)
# course_status.destroy if course_status
# course_status = CourseStatus.create(:course_id => @course.id, :grade => 0)
# end
#
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_successful_update)
# redirect_to settings_course_url(@course)
# }
# format.api { render_api_ok }
# end
#else
# respond_to do |format|
# format.html {
# settings
# render :action => 'settings'
# }
# format.api { render_validation_errors(@course) }
# end
#end
end
def new_join
@ -160,7 +97,6 @@ class CoursesController < ApplicationController
def search
courses_all = Course.all_course
name = params[:name]
#(redirect_to courses_url, :notice => l(:label_sumbit_empty);return) if name.blank?
if name.blank?
@courses = []
@courses_all = []
@ -242,22 +178,19 @@ class CoursesController < ApplicationController
def searchmembers
@subPage_title = l :label_student_list
@render_file = 'member_list'
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
# @is_remote = true
@score_sort_by = "desc"
q = "#{params[:name].strip}"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
if params[:incourse]
@results = searchmember_by_name(student_homework_score(0,0,0,"desc"), q)
results = searchmember_by_name(student_homework_score(0,0,0,"desc"), q)
elsif params[:ingroup]
@group = CourseGroup.find(params[:search_group_id])
@results = searchmember_by_name(student_homework_score(@group.id,0,0,"desc"), q)
results = searchmember_by_name(student_homework_score(@group.id,0,0,"desc"), q)
end
@is_remote = true
@result_count = @results.count
@results = paginateHelper @results, 10
@result_count = results.count
@results = paginateHelper results, 10
@search_name = q
end
@ -269,7 +202,7 @@ class CoursesController < ApplicationController
group.course_id = @course.id
group.save
end
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
@is_remote = true
@course_groups = @course.course_groups
@ -303,17 +236,26 @@ class CoursesController < ApplicationController
valid_attr = params[:valid]
valid_value = params[:value]
faker = CourseGroup.new
group_id = params[:group_id]
# faker = CourseGroup.new
if valid_attr.eql?('name')
faker.name = valid_value
faker.course_id = params[:course_id]
faker.valid?
req[:valid] = faker.errors[:name].blank?
req[:message] = faker.errors[:name]
course = Course.find params[:course_id]
group_names = course.course_groups.map{|group| group.name unless group.id.to_s == group_id}.select{|group| !group.nil?}
if group_names.include?(valid_value)
req[:valid] = false
req[:message] = l(:modal_valid_unpassing)
else
req[:valid] = true
req[:message] = l(:modal_valid_passing)
end
# faker.name = valid_value
# faker.course_id = params[:course_id]
# faker.valid?
# req[:valid] = faker.errors[:name].blank?
# req[:message] = faker.errors[:name]
end
req[:message] = l(:modal_valid_passing) if req[:message].blank?
# req[:message] = l(:modal_valid_passing) if req[:message].blank?
render :json => req
end
def join_group
@ -341,35 +283,28 @@ class CoursesController < ApplicationController
end
def searchgroupmembers
@subPage_title = l :label_student_list
@render_file = 'member_list'
@render_file = 'new_member_list'
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
@score_sort_by = "desc"
if params[:group_id] && params[:group_id] != "0"
@group = CourseGroup.find(params[:group_id])
@results = student_homework_score(@group.id,0, 0,"desc")
@results = paginateHelper @results, 10
else
page_from = params[:page].nil? ? 0 : (params[:page].to_i - 1)
@results = student_homework_score(0,page_from, 10,"desc")
@results = paginateHelper_for_members @results, 10
end
end
def member
## 有角色参数的才是课程,没有的就是项目
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
@render_file = 'member_list'
@render_file = 'new_member_list'
@score_sort_by = "desc"
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
@role = params[:role].nil? ? '2':params[:role]
@is_remote = true
@course_groups = @course.course_groups if @course.course_groups
@ -383,12 +318,9 @@ class CoursesController < ApplicationController
@subPage_title = l :label_student_list
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@all_members = student_homework_score(0,page, 10,"desc")
# @all_members = @course.members
@members = paginateHelper_for_members @all_members, 10
end
respond_to do |format|
if params[:page]
format.js
@ -396,12 +328,9 @@ class CoursesController < ApplicationController
format.html {render :layout => 'base_courses'}
end
end
# render :layout => 'base_courses'
else
render_403
end
end
def export_course_member_excel
@ -415,20 +344,9 @@ class CoursesController < ApplicationController
end
def member_score_sort
# @teachers= searchTeacherAndAssistant(@course)
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
# @role = params[:role]
# @course_groups = @course.course_groups if @course.course_groups
# @show_serch = params[:role] == '2'
@subPage_title = l :label_student_list
@render_file = 'member_list'
# @results = params[:result] if params[:result]
# unless @result.nil?
# @results = @result.reverse
#
# end
# @results = paginateHelper @results@score_sort_by = "desc"
@render_file = 'new_member_list'
@is_remote = true
@score_sort_by = params[:sort_by] if params[:sort_by]
@search_name = params[:search_name] if params[:search_name]
@ -436,7 +354,6 @@ class CoursesController < ApplicationController
if !@search_name.nil?
if group_id == '0'
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@results = searchmember_by_name(student_homework_score(0,0,0,@score_sort_by), @search_name)
@result_count = @results.count
@results = paginateHelper @results, 10
@ -450,7 +367,6 @@ class CoursesController < ApplicationController
if group_id == '0'
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@results = student_homework_score(0,page, 10,@score_sort_by)
@results = paginateHelper_for_members @results, 10
else
@group = CourseGroup.find(group_id)
@ -458,32 +374,25 @@ class CoursesController < ApplicationController
@results = paginateHelper @results, 10
end
end
end
# 显示每个学生的作业评分详情
def show_member_score
@member_score = Member.find(params[:member_id]) if params[:member_id]
respond_to do |format|
format.html {render :layout => 'course_base'}
format.js
end
end
def handle_course courses, activities
course_activity_count_array=activities.values()
course_array=[]
i=0;
courses.each do |course|
course_array[i]=course
i=i+1
end
courses=desc_sort_course_by_avtivity(course_activity_count_array, course_array)
return courses
end
@ -522,57 +431,6 @@ class CoursesController < ApplicationController
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
end
end
#if User.current.user_extensions.identity
# @course = Course.new
# @course.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
# @course.safe_attributes = params[:course]
# @course.tea_id = User.current.id
# # added by bai
# @course.term = params[:term]
# @course.time = params[:time]
# #@course.school_id = params[:occupation]
# @course.school_id = User.current.user_extensions.school_id
# @course.setup_time = params[:setup_time]
# @course.endup_time = params[:endup_time]
# @course.class_period = params[:class_period]
#end
#
#@issue_custom_fields = IssueCustomField.sorted.all
#@trackers = Tracker.sorted.all
#
#if @course.save
# #unless User.current.admin?
# r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
# m = Member.new(:user => User.current, :roles => [r])
# m.project_id = -1
# course = CourseInfos.new(:user_id => User.current.id, :course_id => @course.id)
# #user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id)
# if params[:course][:is_public] == '1'
# course_status = CourseStatus.create(:course_id => @course.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :course_type => @course_tag)
# end
# @course.members << m
# @course.course_infos << course
# #end
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_successful_create)
# if params[:continue]
# redirect_to new_course_url(attrs, :course => '0')
# elsif params[:course_continue]
# redirect_to new_course_url(:course => '1')
# else
# redirect_to settings_course_url(@course, :course_type => 1)
# end
# }
# format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
# end
# else
# #@course.destroy
# respond_to do |format|
# format.html { render :action => 'new', :layout => 'base' } #Added by young
# format.api { render_validation_errors(@course) }
# end
# end
end
def course
@ -590,54 +448,28 @@ class CoursesController < ApplicationController
@course_count = @courses_all.count
@course_pages = Paginator.new @course_count, per_page_option, params['page']
#gcm activity count
@course_activity_count=Hash.new
#count initialize
@courses_all.each do |course|
@course_activity_count[course.id]=0
end
#@course_activity_count=get_course_activity @courses_all,@course_activity_count
#gcm end
case params[:course_sort_type]
when '0'
@courses = @courses_all.order("created_on desc")
@s_type = 0
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#gcm
@course_activity_count=get_course_activity @courses,@course_activity_count
#gcmend
when '1'
@courses = @courses_all.order("course_ac_para desc")
@s_type = 1
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#gcm
@course_activity_count=get_course_activity @courses,@course_activity_count
#gcmend
when '2'
@courses = @courses_all.order("watchers_count desc")
@s_type = 2
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#gcm
@course_activity_count=get_course_activity @courses,@course_activity_count
#gcmend
#gcm
when '3'
#gcm
@course_activity_count=get_course_activity @courses_all,@course_activity_count
#gcmend
@courses=handle_course @courses_all,@course_activity_count
@s_type = 3
@courses = @courses[@course_pages.offset, @course_pages.per_page]
@ -645,11 +477,7 @@ class CoursesController < ApplicationController
@s_type = 0
@courses = @courses_all.order("created_on desc")
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
#gcm
@course_activity_count=get_course_activity @courses,@course_activity_count
#gcmend
end
respond_to do |format|
@ -657,9 +485,6 @@ class CoursesController < ApplicationController
render :layout => 'base'
}
format.api {
# @offset, @limit = api_offset_and_limit
# @course_count = Course.visible.count
# @courses = Course.visible.offset(@offset).limit(@limit).order('lft').all
}
format.atom {
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
@ -668,20 +493,16 @@ class CoursesController < ApplicationController
end
end
def new
@course_type = params[:course_type] ||= params[:course]
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@course = Course.new
@course.safe_attributes = params[:course]
month = Time.now.month
render :layout => 'base'
render :layout => 'new_base'
end
def desc_sort_course_by_avtivity(activity_count, courses)
return courses if activity_count.size<2
(activity_count.size-2).downto(0) do |i|
@ -758,22 +579,11 @@ class CoursesController < ApplicationController
def homework
if @course.is_public != 0 || User.current.member_of_course?(@course) || User.current.admin?
@offset, @limit = api_offset_and_limit({:limit => 10})
@bids = @course.homeworks.order('deadline ASC')
@bids = @bids.like(params[:name]) if params[:name].present?
@bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page']
@offset ||= @bid_pages.reverse_offset
unless @offset == 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
if limit == 0
limit = 10
end
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
bids = @course.homeworks.order('created_on DESC')
bids = bids.like(params[:name]) if params[:name].present?
@bids = paginateHelper bids,10
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
render :layout => 'base_courses'
else
render_403
@ -785,6 +595,7 @@ class CoursesController < ApplicationController
@homework = Bid.new
@homework.safe_attributes = params[:bid]
@homework.open_anonymous_evaluation = 1
@homework.deadline = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else
@ -848,26 +659,19 @@ class CoursesController < ApplicationController
end
def show
# try to redirect to the requested menu item
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
return
end
@users_by_role = @course.users_by_role
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
end
@key = User.current.rss_key
#新增内容
@days = Setting.activity_days_default.to_i
if params[:from]
begin; @date_to = params[:from].to_date + 1; rescue; end
end
has = {
"show_course_files" => true,
"show_course_news" => true,
@ -877,9 +681,7 @@ class CoursesController < ApplicationController
"show_homeworks" => true
}
@date_to ||= Date.today + 1
#
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
#@date_from = @date_to - @days-1.years
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
@author ||= @course.teacher
# 决定显示所用用户或单个用户活动
@ -889,13 +691,11 @@ class CoursesController < ApplicationController
@activity.scope_select {|t| has["show_#{t}"]}
# modify by nwb
# 添加私密性判断
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events(@days, @course.created_at)
else
events = @activity.events(@days, @course.created_at, :is_public => 1)
end
# 无新动态时,显示老动态
if events.count == 0
if User.current.member_of_course?(@course)|| User.current.admin?
@ -904,20 +704,10 @@ class CoursesController < ApplicationController
events = @activity.events(:is_public => 1)
end
end
@offset, @limit = api_offset_and_limit({:limit => 10})
@events_count = events.count
@events_pages = Paginator.new @events_count, @limit, params['page']
@offset ||= @events_pages.offset
events = events.slice(@offset,@limit)
events = paginateHelper events,10
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
# documents
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
# 这写变量发现没有用而且拖慢速度
#@teachers= searchTeacherAndAssistant(@course)
#@canShowRealName = isCourseTeacher(User.current.id,@course)
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
end
@ -947,10 +737,6 @@ class CoursesController < ApplicationController
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
end
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, page
#@offset ||= @feedback_pages.offset
@jour = paginateHelper @jours,10
@state = false
respond_to do |format|
@ -990,7 +776,6 @@ class CoursesController < ApplicationController
end
private
def allow_join course
if course_endTime_timeout? course
respond_to do |format|
@ -1021,38 +806,38 @@ class CoursesController < ApplicationController
if groupid == 0
if nums == 0
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
else
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by} limit #{start_from}, #{nums}"
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by} limit #{start_from}, #{nums}"
end
else
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id})
GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id}
and members.course_group_id = #{groupid} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id})
GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id}
and members.course_group_id = #{groupid} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
end
sql = ActiveRecord::Base.connection()
homework_scores = Member.find_by_sql(sql_select)
@ -1068,7 +853,7 @@ GROUP BY members.user_id ORDER BY score #{score_sort_by}"
#当加入,退出分班时查询分班的学生
def search_group_members group
@subPage_title = l :label_student_list
@render_file = 'member_list'
@render_file = 'new_member_list'
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
@score_sort_by = "desc"

View File

@ -44,18 +44,35 @@ class MessagesController < ApplicationController
end
@reply_count = @topic.children.count
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all
# @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
# @replies = @topic.children.
# includes(:author, :attachments, {:board => :project}).
# reorder("#{Message.table_name}.created_on DESC").
# limit(@reply_pages.per_page).
# offset(@reply_pages.offset).
# all
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
messages_replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
#limit(@reply_pages.per_page).
#offset(@reply_pages.offset).
all
@replies = paginateHelper messages_replies,10
@reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => "base_courses"#by young
else
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all
@reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => "base_projects"#by young
end
end
@ -76,6 +93,13 @@ class MessagesController < ApplicationController
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
else
respond_to do |format|
format.html {
layout_file = @project ? 'base_projects' : 'base_courses'
render :layout => layout_file
}
end
end
end

View File

@ -70,13 +70,13 @@ class NewsController < ApplicationController
scope = @course ? @course.news.course_visible : News.course_visible
@news_count = scope.count
@news_pages = Paginator.new @news_count, @limit, params['page']
@offset ||= @news_pages.offset
@newss = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC",
:offset => @offset,
:limit => @limit)
#@news_pages = Paginator.new @news_count, @limit, params['page']
#@offset ||= scope_page.offset
scope_order = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC")
# :offset => @offset,
# :limit => @limit)
@newss = paginateHelper scope_order,10
respond_to do |format|
format.html {
@news = News.new

View File

@ -73,7 +73,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
@attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
@ -109,7 +109,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
@attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
@ -248,6 +248,8 @@ class TagsController < ApplicationController
@obj = OpenSourceProject.find_by_id(@obj_id)
when '9'
@obj = Course.find_by_id(@obj_id)
when '10'
@obj = Attachment.find_by_id(@obj_id)
else
@obj = nil
end
@ -315,6 +317,14 @@ class TagsController < ApplicationController
when '8'
@obj = OpenSourceProject.find_by_id(obj_id)
@obj_pages, @open_source_projects_results, @results_count = for_pagination(get_open_source_projects_by_tag(selected_tags))
when '10'
@obj = Attachment.find_by_id(obj_id)
# modifed by Long Jun
# this is used to find the attachments that came from the same project and tagged with the same tag.
#@result = get_attachments_by_project_tag(selected_tags, @obj)
@result = get_attachments_by_tag(selected_tags)
@obj_pages, @attachments_results, @results_count = for_pagination(@result)
when '9' then
@obj = Course.find_by_id(obj_id)
@obj_pages, @courses_results, @results_count = for_pagination(get_courses_by_tag(selected_tags))
@ -380,7 +390,9 @@ class TagsController < ApplicationController
when '8'
return 'OpenSourceProject'
when '9'
return 'Course'
return 'Course'
when '10'
return 'Attachment'
else
render_error :message => e.message
return

View File

@ -124,6 +124,20 @@ module ApplicationHelper
end
end
#重载上面方法,增加样式显示
def link_to_user_header user,canShowRealName=false,options={}
if user.is_a?(User)
if canShowRealName
name = h(user.realname(options[:format]))
else
name = h(user.name(options[:format]))
end
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => options[:class]
else
h(user.to_s)
end
end
# Displays a link to +issue+ with its subject.
# Examples:
#
@ -285,7 +299,7 @@ module ApplicationHelper
onclick = "$('##{id}').slideToggle(); "
onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ")
onclick << "return false;"
link_to(name, "#", :onclick => onclick)
link_to(name, "#", :onclick => onclick,:class => options[:class])
end
def image_to_function(name, function, html_options = {})
@ -1651,6 +1665,17 @@ module ApplicationHelper
@public_forum = Forum.find(1)
end
#获取用户未过期的课程
def get_user_course user
courses_doing = []
user.courses.each do |course|
if !course_endTime_timeout?(course)
courses_doing.push course
end
end
courses_doing
end
private
def wiki_helper
@ -1876,7 +1901,7 @@ module ApplicationHelper
def render_dynamic_nav
home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'}
home_link = "<li>" << home_link << "</li>"
home_link = "<li class = 'topnav_a fl'>" << home_link << "</li>"
# bootstrap_render_dynamic_nav
content_tag :ul, (home_link.html_safe+bootstrap_render_dynamic_nav)
end
@ -1917,7 +1942,7 @@ module ApplicationHelper
content_li = ''
nav_list.collect do |nav_item|
content_li << content_tag(:li, nav_item)
content_li << content_tag(:li, nav_item, :class => 'topnav_a fl')
end
content_li.html_safe
end

View File

@ -35,6 +35,16 @@ module AttachmentsHelper
end
end
def link_to_attachments_course(container, options = {})
options.assert_valid_keys(:author, :thumbnails)
if container.attachments.any?
options = {:deletable => container.attachments_deletable?, :author => true}.merge(options)
render :partial => 'attachments/course_file_links',
:locals => {:attachments => container.attachments, :options => options, :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?)}
end
end
def attach_delete(project)
if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
true

View File

@ -25,6 +25,40 @@ module CoursesHelper
# searchTeacherAndAssistant(project).count
end
#课程模块需要展示的模块
def course_model
@nav_dispaly_course_all_label = 1
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1
end
#生成课程老师成员链接
def course_teacher_link teacher_num
if User.current.member_of_course?(@course)
link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'info_foot_num c_blue'
else
content_tag 'span',teacher_num, :class => 'info_foot_num c_blue'
end
end
#生成课程学生列表连接
def course_student_link student_num
if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course))
link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'info_foot_num c_blue'
else
content_tag 'span',student_num, :class => 'info_foot_num c_blue'
end
end
def course_poll_count
Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}").count
end
def course_feedback_count
@course.journals_for_messages.where('m_parent_id IS NULL').count
end
# 返回学生数量即roles表中定义的Reporter
#def studentCount project
# searchStudent(project).count
@ -624,4 +658,82 @@ module CoursesHelper
return activities
end
#获取某个课程的动态数
def course_activity_count course
course_activity_count=Hash.new
course_activity_count[course.id]=0
count = get_course_activity([course],course_activity_count)[course.id]
count.nil? ? 0 : count
end
#重启、关闭课程按钮
def set_course_time course
id = "finish_course_#{course.id}"
linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
end
#加入课程、退出课程按钮
def join_in_course_header(course, user, options=[])
if user.logged?
joined = user.member_of_course? course
text = joined ? ("<em class='pr_arrow'></em>".html_safe + l(:label_course_exit_student)) : ("<em class='pr_add'></em>".html_safe + l(:label_course_join_student))
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post'
if joined
link = "<span class='pr_join_span mr5' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
else
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "<span class='pr_join_span mr5' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>".html_safe
end
else
link = "<span class='pr_join_span mr5' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" +
"<span class='pr_join_span mr5' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>"
end
link.html_safe
end
def bid_anonymous_comment bid
if bid.open_anonymous_evaluation == 1
if bid.homeworks.count >= 2
case bid.comment_status
when 0
link = link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
when 1
link = link_to '关闭匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
when 2
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
end
else
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
end
else
link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
end
link
end
def student_new_homework bid
user_homework = cur_user_homework_for_bid bid
if user_homework && user_homework.empty?
link_to l(:label_commit_homework), new_exercise_book_path(bid),:class => 'fr mr10 work_edit'
else
"<span class='fr mr10 pr_join_span '>作业已交</span>".html_safe
end
end
def student_anonymous_comment bid
if bid.open_anonymous_evaluation == 1
case bid.comment_status
when 0
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
when 1
"<span class='fr mr10 pr_join_span '>正在匿评中</span>".html_safe
when 2
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
end
else
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
end
end
end

View File

@ -20,6 +20,8 @@ module TagsHelper
@obj= Contest.find_by_id(obj_id)
when '9'
@obj= Course.find_by_id(obj_id)
when '10'
@obj = Attachment.find_by_id(obj_id)
else
raise Exception, '[TagsHelper] ===> tag type unknow.'
end

View File

@ -46,6 +46,26 @@ module WatchersHelper
link_to text, url, :remote => true, :method => method, :class => css
end
def watcher_link_with_id(objects, user, options=[])
return '' unless user && user.logged?
objects = Array.wrap(objects)
watched = objects.any? {|object| object.watched_by?(user)}
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid)))
css = options[:class]
text = @watch_flag ?
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
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 => css,:id=>options[:id]
end
############## added by linchun
def new_watcher_link(objects, user, options=[])
return '' unless user && user.logged?

View File

@ -239,6 +239,8 @@ class CoursesService
course.time = params[:time]
course.term = params[:term]
course.class_period = params[:class_period]
params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0
params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0
if course.save
if params[:course][:is_public] == '0'
course_status = CourseStatus.find_by_course_id(course.id)

View File

@ -0,0 +1,72 @@
<div class="attachments" style="font-weight:normal;">
<% is_float ||= false %>
<% for attachment in attachments %>
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%>
<span title="<%= attachment.filename%>" id = "attachment_">
<% if options[:length] %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
<% else %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%>
<% end %>
</span>
<%if is_float%>
</div>
<% end%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments',
:action => 'show',
:id => attachment,
:filename => attachment.filename%>
<% end %>
<span title="<%= attachment.description%>">
<%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %>
</span>
<span class="size">(
<%= number_to_human_size attachment.filesize %>)
</span>
<% if options[:deletable] %>
<% if attachment.container_type == 'HomeworkAttach' %>
<%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id},
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => 'delete delete-homework-icon',
:remote => true,
:title => l(:button_delete) %>
<% else %>
<%= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => 'delete',
#:remote => true,
#:id => "attachments_" + attachment.id.to_s,
:title => l(:button_delete) %>
<% end %>
<% end %>
<% if options[:wrap] %>
<br/>
&nbsp;
<% end %>
<% if options[:author] %>
<span class="author" title="<%= attachment.author%>">
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>,
<%= format_time(attachment.created_on) %>
</span>
<% end %>
</p>
<% end %>
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<div class="thumbnails">
<% images.each do |attachment| %>
<div><%= thumbnail_tag(attachment) %></div>
<% end %>
</div>
<% end %>
<% end %>
</div>

View File

@ -38,7 +38,7 @@
<span class="add_attachment">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()" %>
<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
@ -56,7 +56,7 @@
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<span id="upload_file_count"><%= l(:label_no_file_uploaded)%></span>
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span>

View File

@ -0,0 +1,59 @@
<div class="fl">
<span id="attachments_fields" class="attachments_fields">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
</span>
<% project = project %>
<span class="add_attachment" style="font-weight:normal;">
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js',:project =>project),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<span id="upload_file_count">
<%= l(:label_no_file_uploaded)%>
</span>
(<%= l(:label_max_size) %>:
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>

View File

@ -0,0 +1,27 @@
<a href="javascript:void(0)" class="upimg fl">
<%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
</a>
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
<a href="javascript:void(0)" class="upbtn fl">上传图片</a>
<%= file_field_tag 'avatar[image]',
:id => nil,
:class => 'upload_file ',
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s,
:source_id => source.id.to_s
} %>
<!--</span>-->
<% content_for :header_tags do %>
<%= javascript_include_tag 'avatars' %>
<% end %>
<div class="cl"></div>

View File

@ -3,18 +3,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>开启匿评功能</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;}
div,img,tr,td,textarea{ border:0;}
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ text-decoration:underline;}
/* 匿名评分弹框 */
.anonymos{width:480px;height:180px;position:fixed;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.ni_con { width:425px; margin:25px 30px;}
.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;}
.ni_con p{ color:#808181; }
@ -76,10 +66,10 @@
</p>
<% end %>
<div class="ni_btn">
<a href="#" class="tijiao" onclick="clickOK();" >
<a href="javascript:" class="tijiao" onclick="clickOK();" >
确&nbsp;&nbsp;定
</a>
<a href="#" class="tijiao" onclick="clickCanel();">
<a href="javascript:" class="tijiao" onclick="clickCanel();">
取&nbsp;&nbsp;消
</a>
</div>

View File

@ -91,7 +91,7 @@
<% when 1 %>
<%= link_to '关闭匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true %>
<% when 2 %>
<a href="#" style="background:#8e8e8e;">匿评结束</a>
<a href="javascript:" style="background:#8e8e8e;">匿评结束</a>
<% end %>
</span>
<%end%>

View File

@ -38,7 +38,7 @@
$('#ajax-modal').css('height','240px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='#' onclick='hiddent_alert_model();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
"<a href='javascript:' onclick='hiddent_alert_model();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("width","511");
$('#ajax-modal').parent().addClass("alert_praise");
<% end %>

View File

@ -41,7 +41,7 @@
<tr>
<td><%= f.text_field :reference_user_id, :style=>"display:none"%>
<a href="javascript:void(0);" class="ping_sub" onclick = "clearMessage('bid_message_message');"><%= l(:button_clear_meassge) %></a>
<a href="#" class="ping_sub" id="jours_submit" onclick="submit1();"><%= l(:label_responses) %></a></td>
<a href="javascript:" class="ping_sub" id="jours_submit" onclick="submit1();"><%= l(:label_responses) %></a></td>
</tr>
</table>

View File

@ -0,0 +1,46 @@
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
<%= error_messages_for 'bid' %>
<%= hidden_field_tag 'course_id', @course.id %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_homework_new)%></h2>
</div>
<div class="hwork_new">
<ul>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_name)%>&nbsp;&nbsp;</label>
<input type="text" name="bid[name]" id="bid_name" class="hwork_input" maxlength="<%= Bid::NAME_LENGTH_LIMIT%>" onkeyup="regex_bid_name();" value="<%= bid.name%>" >
<p id="bid_name_span" class="c_red" style="padding-left: 55px;"></p>
</li>
<li class="ml45">
<label class="fl" >&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;&nbsp;</label>
<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"><%= bid.description%></textarea>
</li>
<div class="cl"></div>
<li class="ml21">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_limit_time)%>&nbsp;&nbsp;</label>
<input type="text" name="bid[deadline]" id="bid_deadline" class="hwork_input02" onchange="regexDeadLine();" readonly="readonly" value="<%= bid.deadline%>" >
<%= calendar_for('bid_deadline')%>
</li>
<li class=" mb5 ml30">
<label ><%= l(:label_open_anonymous_evaluation)%>&nbsp;&nbsp;</label>
<input type="checkbox" name="bid[open_anonymous_evaluation]" id="bid_open_anonymous_evaluation" <%= bid.open_anonymous_evaluation == 1 ? 'checked' : ''%> >
<div class="cl"></div>
</li>
<li class="ml9" id="bid_evaluation_num_li" style="display: <%= bid.open_anonymous_evaluation == 1 ? 'block' : 'none'%>;">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_evaluation_num)%>&nbsp;&nbsp;</label>
<input type="text" name="bid[evaluation_num]" id="bid_evaluation_num" class="hwork_input02" onkeyup="regex_evaluation_num();" value="<%= bid.evaluation_num%>">
<span><%= l(:label_evaluation_description)%></span>
<p id="bid_evaluation_num_span" class="c_red" style="padding-left: 90px;"></p>
</li>
<li class="ml45">
<label>&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form', :locals => {:container => bid} %>
</li>
<li class=" ml90" >
<a class="blue_btn fl c_white" onclick="submit_new_bid('<%= bid_id%>');" href="#"><%= l(:button_create)%></a>
<%= link_to l(:button_cancel), homework_course_path(@course), :class => "blue_btn grey_btn fl c_white"%>
<div class="cl"></div>
</li>
</ul>
</div>
<div class="cl"></div>

View File

@ -3,6 +3,6 @@ showModal('ajax-modal', '500px');
$('#ajax-modal').css('height','180px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");

View File

@ -1,129 +1,3 @@
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#bid_name").val());
if(name=="")
{
$("#bid_name_span").text("名称不能为空");
$("#bid_name_span").css('color','#ff0000');
return false;
}
else
{
$("#bid_name_span").text("填写正确");
$("#bid_name_span").css('color','#008000');
return true;
}
}
function regexDeadLine()
{
var deadline = $.trim($("#bid_deadline").val());
var regex = /^\d{4}-\d{2}-\d{2}$/;
if(deadline=="")
{
$("#bid_deadline_span").text("截止日期不能为空");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
else if(regex.test(deadline))
{
$("#bid_deadline_span").text("填写正确");
$("#bid_deadline_span").css('color','#008000');
return true;
}
else
{
$("#bid_deadline_span").text("截止日期格式错误");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
}
function regexEvaluationNum()
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/;
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
if(evaluation_num=="")
{
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
else if(regex.test(evaluation_num))
{
if(evaluation_num > 0)
{
$("#bid_evaluation_num_span").text("填写正确");
$("#bid_evaluation_num_span").css('color','#008000');
return true;
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
return true;
}
}
$(function(){
$("#bid_open_anonymous_evaluation").click(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").slideDown();
}
else
{
$("#evaluation_num_p").slideUp();
}
});
});
$(function(){
$("#bid_open_anonymous_evaluation").click(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").slideDown();
$("#open_anonymous_evaluation_span").slideUp();
}
else
{
$("#evaluation_num_p").slideUp();
$("#open_anonymous_evaluation_span").slideDown();
}
});
});
function submitHomework(id)
{
if(regexDeadLine()&&regexName()&&regexEvaluationNum())
{
$("#edit_bid_" + id).submit();
}
}
</script>
<h3><%= l(:label_edit_homework) %></h3>
<%= labelled_form_for @bid do |f| %>
<div class="box tabular">
<%#= render :partial => 'homework_form', :locals => { :f => f } %>
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<!--<input type="button" onclick="submitHomework(<%#= @bid.id%>);" value="<%#= l(:button_create)%>" class="enterprise">-->
<a href="#" onclick="submitHomework(<%= @bid.id%>);" class="ButtonColor m3p10" >
<%= l(:button_create)%>
</a>
<% end %>
</div>
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}"} %>
<% end %>

View File

@ -1,2 +1,2 @@
alert('关闭成功');
$("#<%= @bid.id %>_anonymous_comment").html('<a href="#" style="background:#8e8e8e;">匿评结束</a>');
$("#<%= @bid.id %>_anonymous_comment").html('<a href="javascript:" style="background:#8e8e8e;">匿评结束</a>');

View File

@ -14,7 +14,7 @@
<%= l(:label_message_new) %>
</div>
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form', :locals => {:f => f} %>
<%= render :partial => 'messages/form_course', :locals => {:f => f} %>
<p>
<!--<input type="button" onclick="submitCoursesBoard();" class = "ButtonColor m3p10 h30" value="<%#= l(:button_submit)%>">-->
<a href="#" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
@ -26,10 +26,11 @@
</div>
<!--display the board-->
<div class="borad-title">
<%=h @board.name %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_board_plural) %></h2>
</div>
<% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_course_board) %>
@ -37,74 +38,41 @@
<hr/>
</div>
<% end %>
<div class="borad-setitle">
<span class="borad-topic-count">
共有
<%=link_to @topic_count,:controller => 'boards',:action => 'index' %>
个贴子
</span>
<span>
<%= link_to l(:label_message_new),
new_board_message_path(@board),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %>
</span>
<div class="talk_top ml15">
<p class="fl"><%= l(:label_totle) %><span><%= @topic_count %></span><%= l(:label_course_momes_count) %></p>
<%= link_to l(:label_message_new),
new_board_message_path(@board),
:class => 'problem_new_btn fl c_dorange' if User.current.logged? %>
<div class="cl"></div>
</div>
<div style="padding-top: 10px">
<% if @topics.any? %>
<% @topics.each do |topic| %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
<td>
<table width="640px" border="0">
<tr>
<td valign="top" width="500px" class=" <%= topic.sticky? ? 'sticky' : '' %>
<%= topic.locked? ? 'locked' : '' %>">
<%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s %>
</td>
<td align="right" rowspan="3">
<table class="borad-count">
<tr>
<td align="center" class="borad-count-digit">
<%=link_to (topic.replies_count), board_message_path(@board, topic) %>
</td>
</tr>
<tr>
<td align="center">
回答
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" colspan="2" >
<span class="font_lighter">
<%= authoring topic.created_on, topic.author %>
<br />
</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %>
<div class="talk_txt fl">
<%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %>
<% if topic.sticky? %>
<a href="#" class="talk_up fl c_red">置顶</a>
<% end %>
<br/>
<p>由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %></p>
</div>
<%=link_to (l(:label_reply) + topic.replies_count.to_s), board_message_path(@board, topic),:class => "talk_btn fr c_white" %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>
<div class="pagination">
<%= pagination_links_full @topic_pages, @topic_count %>
</div>
<% else %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end %>
</div>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %>
<% html_title @board.name %>

View File

@ -0,0 +1,16 @@
<div class="st_list">
<div class="st_search" id="search_members">
<%= render :partial => 'searchmembers' %>
</div>
<div class="cl"></div>
<div class="st_addclass" id="st_groups">
<%= render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups} %>
</div>
<div class="cl"></div>
<div id="member_content">
<%= render :partial => 'new_member_list', :locals => {:members => members} %>
</div>
</div> <!-- st_list end-->
<div class="cl"></div>

View File

@ -0,0 +1,23 @@
<div class="st_list">
<div class="st_box">
<a href="#" class="fr fb mb5" >加入时间</a>
<div class="cl"></div><!--st_box_top end-->
<% members.each do |member| %>
<div class="st_boxlist">
<a href="javascript:" class="st_img">
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
</a>
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
<%= link_to(member.user.name, user_path(member.user),:class => "ml10 c_blue02") %>
<span class="fr c_grey"><%= format_date(member.created_on)%></span>
</div>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div>
</div>

View File

@ -1,10 +1,7 @@
<div class="dis">
<div class="msg_box" id='leave-message'>
<%# reply_allow = JournalsForMessage.create_by_user? User.current %>
<h3>
<%= l(:label_user_response) %>
</h3>
<h4><%= l(:label_leave_message) %></h4>
<% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;">
@ -13,20 +10,14 @@
<hr/>
</div>
<% else %>
<div style="width: 80%; margin-left:10%;">
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_course_message'}) do |f|%>
<%= f.text_area 'course_message',:id => "leave_meassge", :rows => 3, :cols => 65,
:placeholder => "#{l(:label_welcome_my_respond)}",
:style => "resize: none; width: 98%",
:class => 'noline',:maxlength => 250%>
<!--<%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%>-->
<a href="#" onclick='$("#leave_meassge").parent().submit();' class="ButtonColor m3p10" style ="display: block; float: right; margin-right: 1%; margin-top: 1px;"> <%= l(:button_leave_meassge)%>
</a>
<%= f.text_area 'course_message',:id => "leave_meassge",:style => "resize: none;",
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250%>
<a href="#" class="grey_btn fr ml10">取&nbsp;&nbsp;消</a>
<a href="#" onclick='$("#leave_meassge").parent().submit();' class="blue_btn fr"> <%= l(:button_leave_meassge)%></a>
<% end %>
</div>
<% end %>
<div class="cl"></div>
</div>
<div id="history">
@ -35,4 +26,3 @@
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
</div>

View File

@ -1,22 +1,17 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<div class="ping_ctt">
<div id="tbc_01" class="ping_dis">
<% if journals.size > 0 %>
<% for journal in journals %>
<div class="ping_C" id='word_li_<%= journal.id.to_s %>'>
<div class="ping_dispic">
<a target="_blank" href="#">
<%= image_tag(url_to_avatar(journal.user)) %>
</a>
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
</div>
<div class="ping_discon" style="width: 85%;">
<div class="ping_discon" style="width: 610px;">
<div class="ping_distop">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span>
<%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%>
<%= link_to journal.user, user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%>
</span>
<span style="color:#a6a6a6; margin-right:40px; margin-left:30px;">
<span class="c_grey fr">
<%= format_time(journal.created_on) %>
</span>
<div class="cl"></div>
@ -26,7 +21,7 @@
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span style="float: right">
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
@ -38,31 +33,28 @@
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<% end %>
</span>
<span class="font_lighter" style="float: right">
<%= l(:label_bids_published) %>&nbsp;
<%= time_tag(journal.created_on).html_safe %>&nbsp;
<%= l(:label_bids_published_ago) %>
</span>
</div>
<div style="clear: both;"></div>
<div class="cl"></div>
<!--<span class="font_lighter" style="float: right">
<#%= l(:label_bids_published) %>&nbsp;
<#%= time_tag(journal.created_on).html_safe %>&nbsp;
<#%= l(:label_bids_published_ago) %>
</span>-->
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
<%= render :partial => 'words/new_respond_course', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
</div>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true, :allow_delete => @course && User.current.allowed_to?(:as_teacher,@course)} %>
</div>
<div class="cl"></div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true, :allow_delete => @course && User.current.allowed_to?(:as_teacher,@course)} %>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
</div>
</div>

View File

@ -68,10 +68,10 @@
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
</li>
<li>
<a href="#" class="btn" style="margin-left: 50px;" onclick="submit_form(this);">
<a href="javascript:" class="btn" style="margin-left: 50px;" onclick="submit_form(this);">
<%= l(:label_new_join) %>
</a>
<a href="#" class="btn" style="margin-left: 20px;" onclick="hideModal(this);">
<a href="javascript:" class="btn" style="margin-left: 20px;" onclick="hideModal(this);">
<%= l(:button_cancel)%>
</a>
</li>

View File

@ -1,9 +1,7 @@
<div style="margin-left: 15px" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<div style="margin-left: 15px">
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<% if !@canShowCode %>
<%= join_in_course_group(@course.course_groups,@group, User.current) %>
<% end %>
<%= join_in_course_group(@course.course_groups,@group, User.current) unless @canShowCode %>
<span style="font-size: 12px; float: left; margin-right: 5px">
<%= l(:label_current_group)%>:&nbsp;
<%= @group.name %>
@ -25,7 +23,8 @@
<div class="st_box">
<ul class="st_box_top" style="margin-left: 17px;">
<% if @subPage_title == l(:label_student_list) %>
<li class="ml358"><%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
<li class="ml358">
<%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
<% if @score_sort_by == 'desc' %>
<a id="pic" href="#" class= "st_down"></a>
<% else %>
@ -33,7 +32,7 @@
<% end %>
</li>
<li class="ml50">
<a href="#" >加入时间</a>
<a href="javascript:" >加入时间</a>
</li>
<% else %>
<li class="ml50">
@ -41,7 +40,7 @@
<li class="ml50" style="margin-left: 470px">
</li>
<li class="ml50" style="margin-left: 80%">
<a href="#" >加入时间</a>
<a href="javascript:" >加入时间</a>
</li>
<% end %>
@ -51,7 +50,7 @@
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<a href="#" class="st_img" style="float:left;">
<a href="javascript:" class="st_img" style="float:left;">
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %>
</a>
<ul style="margin-left: 15px">

View File

@ -0,0 +1,56 @@
<ul>
<li style=" color:#8b8b8b;">分班:</li>
<li class="classbox" id="course_group_0">
<%= link_to l(:label_all), searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('course_group_0')", method: 'get', remote: true%>
</li>
<% unless course_groups.nil? %>
<% course_groups.each do |group| %>
<% group_name = " #{ group.name}( <span class='c_red'>#{group.members.count.to_s}人</span>)".html_safe %>
<li class="classbox" style="margin-bottom: 5px;">
<%= link_to group_name, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,:onclick => "checkclass('group_name_#{group.id}')"%>
<% if @canShowCode%>
<% if group.members.empty?%>
<%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true,
:data => {confirm: l(:label_delete_group)},
:class => 'f_1',
:style => "width: 11px;height: 16px;margin-top:3px;margin-left:5px;background: url(/images/pic_del.gif) no-repeat 0 0;"
%>
<% else%>
<a href="javascript:" onClick="alert('温馨提示:已有学生加入该班级,不能删除该班级,仅可编辑班级名称。');" style="margin-right:4px;" >
<img src="/images/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级" />
</a>
<% end%>
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('');$('#edit_group_<%= group.id %>').slideToggle();">
<img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" />
</a>
<% end %>
</li>
<!-- 编辑分班 -->
<li>
<% if @canShowCode%>
<%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, :id => 'update_group_'+group.id.to_s) do %>
<span id="edit_group_<%= group.id %>" style="display:none; vertical-align: middle;" class=" f_l">
<input type="text" id="group_name_<%= group.id%>" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="edit_group('group_name_<%= group.id%>','<%= valid_ajax_course_path%>','<%= @course.id%>','<%= group.id%>');"/>
</span>
<% end %>
<% end %>
</li>
<% end %>
<% end %>
<% if @canShowCode %>
<li style="margin-left:15px;margin-top: 2px;">
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();">+添加分班</a>
</li>
<li >
<span id="new_group_name" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_tag( addgroups_course_path(@course), method: 'get',:remote=>true,:id => 'add_group_name') do %>
<input type="text" id="group_name" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="add_group('<%= valid_ajax_course_path%>','<%= @course.id%>');"/>
<% end %>
</span>
</li>
<% end %>
</ul>

View File

@ -0,0 +1,81 @@
<!-- 加入分班 -->
<div style="margin-left: 15px">
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<%= join_in_course_group(@course.course_groups,@group, User.current) unless @canShowCode %>
<span style="font-size: 12px; float: left; margin-right: 5px">
<%= l(:label_current_group)%>:&nbsp;
<%= @group.name %>
</span>
<% end %>
</div>
<div class="cl"></div>
<% if members.any? %>
<% if @result_count %>
<p style="font-size: 18px;">
<%= l(:label_search_member_count) %>
<%= @result_count %>
<%= l(:label_member_people) %>
</p>
<div class="cl"></div>
<% end %>
<div class="st_box">
<ul class="st_box_top">
<li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li>
<li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li>
<li class="ml358">
<%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
<% if @score_sort_by == 'desc' %>
<a id="pic" href="javascript:" class= "st_down"></a>
<% else %>
<a id="pic" href="javascript:" class= "st_up"></a>
<% end %>
</li>
<li class="ml50"><a href="#" >加入时间</a></li>
</ul>
<div class="cl"></div><!--st_box_top end-->
<% members.each do |member| %>
<div class="st_boxlist">
<a href="javascript:" class="st_img">
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
</a>
<ul>
<% if @canShowCode %>
<li>
<% if member.user.show_name == ''%>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.name}</span>".html_safe,user_path(member.user)) %>
<% else%>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
<%end%>
</li>
<% else %>
<li><%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.name}</span>".html_safe, user_path(member.user)) %></li>
<% end %>
<br/>
<% unless member.user.user_extensions.student_id == ''%>
<li><%= link_to("#{l(:label_bidding_user_studentcode)}<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
<% end%>
</ul>
<%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), {
:action => 'show_member_score',
:member_id => member.id,
:remote => true},
:class => 'ml258 c_red' %>
<span class="ml65 c_grey"><%= format_date(member.created_on)%></span>
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
</div>
<div class="cl"></div>
<% end; reset_cycle %>
</div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<% else%>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end%>

View File

@ -1,12 +1,11 @@
<% if @subPage_title && @subPage_title == l(:label_student_list)%>
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px; float: left;"%>
<% if @group %>
<%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
<%= submit_tag l(:label_search_member), :name => "ingroup",:class => "f_2", :style => "float: left "%>
<% else %>
<%= submit_tag l(:label_search_member),:style => "float: left", :name => 'incourse',:onclick => "checkclass('group_name_0')",:class => "f_2"%>
<% end %>
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生姓名、学号进行搜索'%>
<% if @group %>
<%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
<input type="hidden" name="ingroup">
<% else %>
<input type="hidden" name="incourse">
<% end %>
<%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'),:class=>'xls'%>
<% end %>
<a href="javascript:" class="f_l" onclick="$('#search_student').submit();">搜索</a>
<%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'),:class=>'xls'%>

View File

@ -1 +1 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");

View File

@ -1 +1 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");

View File

@ -1,5 +1,9 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<%= stylesheet_link_tag 'css', :media => 'all' %>
<!-- <#%= stylesheet_link_tag 'css', :media => 'all' %> -->
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_contest_userresponse) %></h2>
</div>
<%= render :partial => 'courses_jours',
:locals => { :contest => @contest, :journals => @jour, :state => false}
@ -9,7 +13,7 @@
<script>
var W3CDOM = document.createElement && document.getElementsByTagName;
window.onload = setMaxLength;
//window.onload = setMaxLength;
function setMaxLength() {
if (!W3CDOM) return;
@ -21,7 +25,7 @@ function setMaxLength() {
}
function setMaxLengthItem(textarea){
if (textarea.getAttribute('maxlength')) {
var counter = document.createElement('div');
var counter = document.createElement('span');
counter.className = 'counter';
var counterClone = counter.cloneNode(true);
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');

View File

@ -1,10 +1,6 @@
<% if @save_flag %>
<% if Rails.env.development? %>
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>');
<% end %>
$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user,
:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>");
$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>");
$('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>");
// alert("关闭成功");
<% else %>
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
<% end %>

View File

@ -1,63 +1,62 @@
<style type="text/css">
#attachments_fields input.description {
width: auto;
}
</style>
<%= javascript_include_tag 'attachments' %>
<!-- fq -->
<div class="content-title-top">
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%>
<%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %>
<% else %>
<span class="font_lighter">
<%= l(:label_coursejoin_tip) %>
</span>
<% end %>
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_homework)%>
</h2>
</div>
<div id="bid-show">
<%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
<div class="talk_top">
<p class="fl">
<%= l(:label_totle)%><span><%= @obj_count%></span><%= l(:label_homework_count)%>
</p>
<%= link_to( l(:label_course_homework_new), new_homework_course_path(@course), :class => 'problem_new_btn fl c_dorange') if @is_teacher %>
<div class="cl"></div>
</div>
<div id="OpenWindow">
<div id="signup-ct">
<div id="OpenWindow-header">
<h1> 课程: <%= @course.name%> </h1>
<p id='bid-desc'> 上传作业 </p>
<a href="javascript:void(0);" class="modal_close"></a>
<% @bids.each do |bid|%>
<div class="problem_main">
<%= link_to(image_tag(url_to_avatar(bid.author), :width => "42", :height => "42"), user_path(bid.author), :class => "problem_pic fl") %>
<div class="problem_txt fl mt5">
<%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author),:class => 'problem_name fl') %>
<span class="fl"> <%= l(:label_user_create_project_homework) %></span>
<%= link_to(bid.name, course_for_bid_path(bid), :class => 'problem_tit fl fb c_dblue') %>
<div class="cl mb5"></div>
<p class="fl "><%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )</p>
<% if @is_teacher%>
<%= bid_anonymous_comment(bid)%>
<%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %>
<% elsif @is_student%>
<%= student_anonymous_comment bid %>
<%= student_new_homework bid %>
<% end %>
<div class="cl"></div>
<script>
$(function(){if($("#bid_description_<%= bid.id%>_content").height()>38){$("#bid_show_more_des_button<%= bid.id%>").show();}});
</script>
<div id="bid_description_<%= bid.id%>" class="news_description mt5">
<div id="bid_description_<%= bid.id%>_content">
<%= textilizable bid, :description %>
</div>
</div>
<div id="OpenWindow-content">
<div class="news_foot c_red" id="bid_show_more_des_button<%= bid.id%>" onclick="bid_show_more_des(<%= bid.id%>);" style="cursor:pointer;display: none;">
<%= l(:button_more)%>...
<span class="g-arr-down"></span>
</div>
<span class="fl"><%= l(:label_end_time)%><%= bid.deadline%></span>
<% if betweentime(bid.deadline) < 0 %>
<span class='fr mr10 c_red '>
<%= l(:label_commit_limit)%>
</span>
<% else %>
<script type="text/javascript">
window.setInterval(function(){show_bid_dead_line(<%= bid.deadline.year%>,<%= bid.deadline.month%>,<%= bid.deadline.day + 1%>,"bid_deadline_<%= bid.id%>");},1000)
</script>
<div id="bid_deadline_<%= bid.id%>">
</div>
<% end %>
</div>
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
$("a[rel*=leanModal]").leanModal({
top:100,
closeButton: ".modal_close"
});
<% end%>
function showSubH(/* ... */){
var id, name, numargs = arguments.length;
id = arguments[0];
name = arguments[1];
$("#OpenWindow").find("#bid-desc").html('作业名: '+name);
post_url = '/bids/' + id + '/homework_ajax_modal.js'
function deal_post (data, textStatus, xhr) {
if(textStatus == 'success'){
eval(data);
}
if(textStatus != 'success'){
$('#OpenWindow-content').html('<span class=\"font_color_orange\" > ' + textStatus + ' <\/span>\n');
}
}
function deal_error (argument) {
$('#OpenWindow-content').html('<strong>Network Error</strong><span class=\"font_color_orange\" > <br/>http_status:' + argument.status + '<br/>statusText:' + argument.statusText + ' <\/span>\n');
}
$.post(post_url,{}, deal_post).error(deal_error);
}
</script>
<% html_title(l(:label_homework)) -%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>

View File

@ -1,2 +1,2 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");

View File

@ -3,7 +3,7 @@ showModal('ajax-modal', '510px');
$('#ajax-modal').css('height','330px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
"<a href='javascript:' onclick='hidden_join_course_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","");
$('#ajax-modal').parent().addClass("alert_box");

View File

@ -1,81 +1,9 @@
<script type="text/javascript">
function check_groupname() {
var $group_name = $('#group_name');
$.get(
'<%=valid_ajax_course_path%>',
{ valid: "name",
value: document.getElementById('group_name').value,
course_id: <%= @course.id %> },
function (data) {
if (!data.valid) {
alert(data.message);
}
});
}
</script>
<script type=" text/javascript" charset="utf-8">
function validate_groupname(value1) {
if(value1.length > 20) {
alert('<%= l(:label_limit_groupname) %>');
}
}
function checkclass(value) {
for(var i = 0; i < document.getElementsByName("check_group_name").length; i++) {
if(document.getElementsByName("check_group_name")[i].id == value) {
document.getElementById(value).className = "selected";
}
else {
document.getElementsByName("check_group_name")[i].className = "classbox";
}
}
}
function validate_groupname_null(value1) {
value1 = value1.trim();
if(value1.length == 0 ) {
alert('<%= l(:label_limit_groupname_null) %>');
}
}
function validate_update(name) {
value1 = document.getElementById(name).value;
validate_groupname(value1);
}
function validate_add_group() {
check_groupname();
}
</script>
<%= stylesheet_link_tag 'course_group', :media => 'all' %>
<script type="text/javascript" src="javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js"></script>
<div class="st_list" id="member_of_course">
<div class="st_search" style="margin-left: 14px" >
<span class="f_l"><%= @subPage_title %></span>
<span id = "search_members">
<%= render :partial => 'searchmembers' %>
</span>
</div>
<div class="cl"></div>
<% if @subPage_title == l(:label_student_list) %>
<div class="st_addclass" id = "st_groups">
<%= render :partial => 'groups_name', :locals => {:course_groups => @course_groups} %>
</div>
<% end %>
<div class="cl"></div>
<div class="member_content" id = "member_content">
<%= error_messages_for 'member' %>
<%= render :partial => @render_file, :locals => {:members => @members} %>
</div>
<div class="project_r_h">
<h2 class="project_h2"><%= @subPage_title%></h2>
</div>
<% if @subPage_title == l(:label_student_list)%>
<%= render :partial => 'course_student', :locals => {:members => @members} %>
<% else%>
<%= render :partial => 'course_teacher', :locals => {:members => @members} %>
<% end%>

View File

@ -1,4 +1,4 @@
/**
* Created by Administrator on 2014/12/3.
*/
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
$("#member_content").html("<%= escape_javascript( render :partial => "new_member_list", :locals => {:members => @results})%>");

View File

@ -1,16 +1,56 @@
<% @nav_dispaly_course_all_label = 1
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1 %>
<h3><%=l(:label_course_new)%></h3>
<%= labelled_form_for @course do |f| %>
<div class="box tabular">
<%= render :partial => 'course_form', :locals => { :f => f } %>
<span style="padding-left: 60px; margin-left: 36px">
<%= submit_tag l(:button_create), :class => "enterprise"%>
</span>
<!-- <%#= submit_tag l(:button_create_and_continue), :name => 'course_continue' %> -->
<%= javascript_tag "$('#course_name').focus();" %>
</div>
<% end %>
<% html_title(l(:label_course_new)) -%>
<div class="project_r_h02">
<h2 class="project_h2"><%= l(:permission_new_course)%></h2>
</div>
<div class="hwork_new">
<ul>
<%= labelled_form_for @course do |f| %>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
</li>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6">
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02" >
<div class="cl"></div>
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>
<li class="ml45">
<label class="fl" >&nbsp;&nbsp;<%= l(:label_new_course_description)%>&nbsp;&nbsp;</label>
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
<div class="cl"></div>
</li>
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input checked="checked" id="course_is_public" name="course[is_public]" type="checkbox" value="1">
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生列表公开&nbsp;&nbsp;</label>
<input id="course_open_student" name="course[open_student]" type="checkbox" value="1">
<span class="c_grey">(打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)</span>
<div class="cl"></div>
</li>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
<a href="javascript:history.back()" target="_blank" class="blue_btn grey_btn fl c_white">取消</a>
<div class="cl"></div>
</li>
<% end%>
</ul>
</div><!--talknew end-->
<div class="cl"></div>

View File

@ -1,115 +1,3 @@
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#bid_name").val());
if(name=="")
{
$("#bid_name_span").text("名称不能为空");
$("#bid_name_span").css('color','#ff0000');
return false;
}
else
{
$("#bid_name_span").text("填写正确");
$("#bid_name_span").css('color','#008000');
return true;
}
}
function regexDeadLine()
{
var deadline = $.trim($("#bid_deadline").val());
var regex = /^\d{4}-\d{2}-\d{2}$/;
if(deadline=="")
{
$("#bid_deadline_span").text("截止日期不能为空");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
else if(regex.test(deadline))
{
$("#bid_deadline_span").text("填写正确");
$("#bid_deadline_span").css('color','#008000');
return true;
}
else
{
$("#bid_deadline_span").text("截止日期格式错误");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
}
function regexEvaluationNum()
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/;
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
if(evaluation_num=="")
{
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
else if(regex.test(evaluation_num))
{
if(evaluation_num > 0)
{
$("#bid_evaluation_num_span").text("填写正确");
$("#bid_evaluation_num_span").css('color','#008000');
return true;
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
return true;
}
}
$(function(){
$("#bid_open_anonymous_evaluation").click(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").slideDown();
$("#open_anonymous_evaluation_span").slideUp();
}
else
{
$("#evaluation_num_p").slideUp();
$("#open_anonymous_evaluation_span").slideDown();
}
});
});
function submitHomework()
{
if(regexDeadLine()&&regexName()&&regexEvaluationNum())
{
$("#new_bid").submit();
}
}
</script>
<h3><%=l(:label_course_new_homework)%></h3>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<div class="box tabular">
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<!--<input type="button" onclick="submitHomework();" value="<%#= l(:button_create)%>" class="enterprise">-->
<a href="#" onclick="submitHomework();"class="ButtonColor m3p10"><%= l(:button_create)%></a>
<%= javascript_tag "$('#bid_name').focus();" %>
<% end %>
</div>
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid" } %>
<% end %>

View File

@ -1,4 +1,4 @@
/**
* Created by Administrator on 2014/12/2.
*/
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");
$("#member_content").html("<%= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>");

View File

@ -1,3 +1,60 @@
<h3><%=l(:label_settings)%></h3>
<%= render_tabs course_settings_tabs %>
<% html_title(l(:label_settings)) -%>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_modify_settings)%></h2>
</div>
<div class="hwork_new">
<ul>
<%= labelled_form_for @course do |f| %>
<li class="ml45 mb10">
<%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %>
<div class="cl"></div>
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
</li>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
<input type="text" name="class_period" id="class_period" class="hwork_input02" onkeyup="regex_course_class_period();" maxlength="6" value="<%= @course.class_period%>">
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02" value="<%= @course.password%>">
<div class="cl"></div>
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>
<li class="ml45">
<label class="fl" >&nbsp;&nbsp;<%= l(:label_new_course_description)%>&nbsp;&nbsp;</label>
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" maxlength="6000"><%= @course.description%></textarea>
<div class="cl"></div>
</li>
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input <%= @course.is_public == 1 ? 'checked' : ''%> id="course_is_public" name="course[is_public]" type="checkbox">
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生列表公开&nbsp;&nbsp;</label>
<input <%= @course.open_student == 1 ? 'checked' : ''%> id="course_open_student" name="course[open_student]" type="checkbox" style="margin-left: 1px;"/>
<span class="c_grey">(打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)</span>
<div class="cl"></div>
</li>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_edit_course(<%= @course.id%>);" >提交</a>
<%= link_to l(:button_cancel), course_path(@course), :class => "blue_btn grey_btn fl c_white" %>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div><!--talknew end-->
<div class="cl"></div>

View File

@ -1,143 +1,50 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_activity)%></h2>
</div>
<% if @events_by_day != nil && @events_by_day.size >0 %>
<div class="content-title-top-avtive">
<p class="subtitle">
</p>
<% @events_by_day.keys.sort.reverse.each do |day| %>
<div>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div>
<table class="underline-evreycontent" style="font-size: 14px;">
<tr>
<td valign="top" width="50">
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %>
</td>
<td>
<table width="580px" border="0" style="width: 100%;table-layout: fixed">
<tr>
<td colspan="2" valign="top" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<strong>
<%= h(e.event_title) if @course.nil? || (e.course != nil && @course.id != e.course.id) %>
</strong>
<span class="font_lighter">
<% if @canShowRealName %>
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
(<%= link_to_user(e.event_author, @canShowRealName) if e.respond_to?(:event_author) %>)
<% else %>
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
<% end %>
<%= l(:label_new_activity) %>
</span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url%>
</td>
</tr>
<tr>
<td colspan="2" width="580px">
<p class="info-break">
<%= e.event_description %>
</p>
</td>
</tr>
<tr>
<td align="left">
<span class="font_lighter">
<%= l :label_activity_time %>
&nbsp;
<%= format_activity_day(day) %>
<%= format_time(e.event_datetime, false) %>
</span>
</td>
<% if e.event_type == "issue" %>
<td align="right">
<span>
<%= link_to l(:label_find_all_comments), issue_path(e.id) %>
</span>
<span class="font_lighter">
<%= l(:label_comments_count, :count => e.journals.count) %>
</span>
</td>
<% end %>
</tr>
</table>
</td>
</tr>
</table>
</div>
<% end %>
</div>
<% end -%>
<% if (@events_pages.page == @events_pages.last_page) %>
<div class="font_description">
<table width="660">
<tr>
<td>
<%= image_tag(url_to_avatar(@user), :class => "avatar") %>
</td>
<td colspan="2">
<table width="580">
<tr>
<td>
<% if @canShowRealName %>
(<%= link_to_user(@user, @canShowRealName) %>)
<% else %>
<%= link_to_user(@user)%>
<% end %>
<%= l(:label_user_create_project) %>
<%= link_to @course.name %>
<strong> !</strong>
</td>
</tr>
<tr>
<td class="font_lighter" >
<%= l :label_create_time %>:
<%= format_time(@course.created_at) %>
</table>
</td>
</tr>
</table>
</div>
<% end %>
</div>
<%else%>
<div class="font_description">
<table width="660">
<tr>
<td>
<%= image_tag(url_to_avatar(@user), :class => "avatar") %>
</td>
<td colspan="2">
<table width="580">
<tr>
<td>
<% if @canShowRealName %>
(<%= link_to_user(@user, @canShowRealName) %>)
<% else %>
<%= link_to_user(@user)%>
<% end %>
<%= l(:label_user_create_project) %>
<%= link_to @course.name %>
<strong> !</strong>
</td>
</tr>
<tr>
<td class="font_lighter" style="float: right">
<%= l :label_create_time %>:
<%= format_time(@course.created_at) %>
</table>
</td>
</tr>
</table>
</div>
<% end %>
<div class="pagination">
<ul>
<%= pagination_links_full @events_pages %>
</ul>
</div>
<% html_title(l(:label_course_overview)) -%>
<% @events_by_day.keys.sort.reverse.each do |day| %>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="problem_main">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5">
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %>
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
<span class="fl"> <%= l(:label_new_activity) %></span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5 break_word"><%= e.event_description %>
<br />
<%= l :label_activity_time %> <%= format_activity_day(day) %><%= format_time(e.event_datetime, false) %>
</p>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<% end%>
<% end%>
<div class="problem_main">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5">
<%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %>
<%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %>
<span class="fl"> <%= l(:label_user_create_project) %></span>
<%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5">
<br />
<%= l :label_create_time %>: <%= format_time(@course.created_at) %>
</p>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>

View File

@ -1,2 +1,2 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");

View File

@ -1,4 +1,4 @@
/**
* Created by Administrator on 2014/12/3.
*/
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
$("#st_groups").html("<%= escape_javascript( render :partial => 'new_groups_name', locals: {:course_groups => @course_groups})%>");

View File

@ -22,7 +22,7 @@
</span>
</div>
<button name="button" class="f_l ml10" onclick="_file.click()" onmouseover="this.focus()" type="button" style="<%= ie8? ? 'display:none' : '' %>; width:20%; height:26%;"><%= l(:label_browse)%></button>
<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" type="button"><%= l(:label_browse)%></button>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
@ -41,10 +41,9 @@
:delete_all_files => l(:text_are_you_sure_all)
} %>
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
<label class="f_l ml10 c_grey" style=" margin-top: 3px;">
<span id="upload_file_count">
<%= l(:label_no_file_uploaded)%>
</span>
(<%= l(:label_max_size) %>:
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</label>

View File

@ -2,15 +2,16 @@
<% sufixtypes = @course.contenttypes %>
<%= stylesheet_link_tag 'resource', :media => 'all' %>
<!--<%#= stylesheet_link_tag 'resource', :media => 'all' %> -->
<script>
function show_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","5").css("left","511");
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>")
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
@ -47,8 +48,8 @@
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<% if is_course_teacher(User.current,@course) %>
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload()">上传资源</a>
<% if is_course_teacher(User.current,@course) %> <!-- show_window('light','fade','20%','35%')-->
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>
<% end %>
</div><!---re_top end-->
<div class="cl"></div>
@ -58,6 +59,5 @@
</div><!---re_con end-->
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -45,8 +45,8 @@
</div>
<div class="cl"></div>
<div class="tag_h">
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "10"} %>
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "10"} %>
</div>
<div class="cl"></div>
</div><!---re_con_box end-->

View File

@ -14,7 +14,7 @@
id: "relation_file_form" do %>
<%= hidden_field_tag(:file_id, file.id) %>
<%= content_tag('div', courses_check_box_tags('courses[course][]', User.current.courses,course,file), :id => 'courses')%>
<a id="submit_quote" href="javascript:void(0)" class="upload_btn" onclick="submit_quote();">引&nbsp;&nbsp;用</a><a href="javascript:void(0)" class="upload_btn upload_btn_grey" onclick="closeModal();">取&nbsp;&nbsp;消</a>
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引&nbsp;&nbsp;用</a><a href="javascript:void(0)" class="blue_btn grey_btn fl c_white" onclick="closeModal();">取&nbsp;&nbsp;消</a>
<% end -%>
</div>
<% end %>

View File

@ -1,4 +1,5 @@
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
<div id="popbox_upload" class="box_h3 mb10" style="margin-top: -30px">
<div class="upload_con">
<h2><%= l(:label_upload_files)%></h2>
<div class="upload_box">
@ -9,8 +10,8 @@
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
<div class="cl"></div>
<a id="submit_resource" href="javascript:void(0);" class="upload_btn" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<a href="javascript:void(0);" class="upload_btn upload_btn_grey" onclick="closeModal();"><%= l(:button_cancel)%></a>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<% end %>
</div>

View File

@ -7,4 +7,5 @@
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","5").css("left","511");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -53,7 +53,7 @@
:maxlength => 250 %>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<div style="float:right">
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit_jours(<%= @is_teacher%>);">
<a href="javascript:" class="ping_sub1" id="jours_submit" onclick="submit_jours(<%= @is_teacher%>);">
<%= l(:label_confirmation) %>
</a>
</div>

View File

@ -61,7 +61,7 @@
<%= render_new_members_for_homework(members) %>
</div>
<p style="padding-left: 20px;">
<a href="#" class="tijiao" id='member-add-submit' onclick="submit_homework_user();">
<a href="javascript:" class="tijiao" id='member-add-submit' onclick="submit_homework_user();">
<%= l(:button_add) %>
</a>
</p>

View File

@ -11,8 +11,8 @@
<h2><img src="/images/bid/pic_top.jpg" width="188" height="37" alt="匿名评价" /></h2>
<p>&nbsp;&nbsp;&nbsp;&nbsp;据说雷锋做完好事是从来不留名的呢,我们这次评分也不留名!!!但是,但是,您给的分数一定要公正哦,老天爷看不到,我们的系统可是清楚得很!</p>
<p style="margin-bottom:15px;">&nbsp;&nbsp;&nbsp;&nbsp;别怪我没告诉你,系统分配给你的作品不评价可是要扣分的哈!</p>
<a href="#" class="tijiao" style="margin-left:100px;" onclick="hideModal(this)">匿名评分</a>
<a href="#" style="color:#15bccf; margin-top:20px; display:block;" onclick="hideModal(this)">冒着扣分的危险残忍拒绝</a>
<a href="javascript:" class="tijiao" style="margin-left:100px;" onclick="hideModal(this)">匿名评分</a>
<a href="javascript:" style="color:#15bccf; margin-top:20px; display:block;" onclick="hideModal(this)">冒着扣分的危险残忍拒绝</a>
</div>
</div>

View File

@ -1,6 +1,6 @@
<span><a href="#" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star02" onclick="ChoseStars(2)" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star01" onclick="ChoseStars(1)" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star02" onclick="ChoseStars(2)" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star01" onclick="ChoseStars(1)" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
<input type="hidden" value="<%= start_score%>" id="stars_value" name="stars_value"/>

View File

@ -1,5 +1,5 @@
<span><a href="#" id="star05" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star04" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star03" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star02" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star01" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star05" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star04" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star03" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star02" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star01" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>

View File

@ -107,7 +107,7 @@
<span style="float: left;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<a href="#" class="tijiao" onclick="submit_homework_form();">
<a href="javascript:" class="tijiao" onclick="submit_homework_form();">
<%= l(:label_button_ok) %>
</a>
<a href="javascript:history.back()" class="tijiao">取&nbsp;&nbsp;消</a>

View File

@ -103,7 +103,7 @@
<span style="float: left;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<a href="#" class="tijiao" onclick="submit_homework_form();">
<a href="javascript:" class="tijiao" onclick="submit_homework_form();">
<%= l(:label_button_ok) %>
</a>
<a href="javascript:history.back()" class="tijiao">取&nbsp;&nbsp;消</a>

View File

@ -110,7 +110,7 @@ $(function(){
myTips("<%= l(:label_feedback_success) %>","success");
});
})
});
function f_submit()
{

View File

@ -22,14 +22,26 @@
</p>
<div id="logo_link">
<% if @companies.nil? || @companies.count == 0 %>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>l(:label_co_organizer_EECS)), "http://eecs.pku.edu.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>l(:label_co_organizer_CAS)), "http://www.iscas.ac.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>l(:label_co_organizer_InforS)), "http://www.inforbus.com", :target => "_blank" %></span>
<span class="footer_logo_link">
<%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %>
</span>
<span class="footer_logo_link">
<%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>l(:label_co_organizer_EECS)), "http://eecs.pku.edu.cn", :target => "_blank" %>
</span>
<span class="footer_logo_link">
<%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank" %>
</span>
<span class="footer_logo_link">
<%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>l(:label_co_organizer_CAS)), "http://www.iscas.ac.cn", :target => "_blank" %>
</span>
<span class="footer_logo_link">
<%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>l(:label_co_organizer_InforS)), "http://www.inforbus.com", :target => "_blank" %>
</span>
<% else %>
<% @companies && @companies.each do |company| %>
<span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span>
<span class="footer_logo_link">
<%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %>
</span>
<% end %>
<% end %>
</div>

View File

@ -1,32 +1,3 @@
<%
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
realUrl = request.original_url
if (realUrl.match(/.*forge\.trustie\.net\/*/))
#@nav_dispaly_project_label = 1
#@nav_dispaly_forum_label = 1
elsif (realUrl.match(/.*course\.trustie\.net\/*/))
#@nav_dispaly_course_all_label = 1
#@nav_dispaly_forum_label = 1
#@nav_dispaly_course_label = nil
#@nav_dispaly_store_all_label = 1
elsif (realUrl.match(/.*user\.trustie\.net\/*/))
#@nav_dispaly_home_path_label = 1
#@nav_dispaly_main_course_label = 1
#@nav_dispaly_main_project_label = 1
#@nav_dispaly_main_contest_label = 1
elsif (realUrl.match(/.*contest\.trustie\.net\/*/))
#@nav_dispaly_contest_label = 1
#@nav_dispaly_store_all_label = 1
else
#@nav_dispaly_project_all_label = 1
#@nav_dispaly_course_all_label = 1
#@nav_dispaly_forum_label = 1
#@nav_dispaly_bid_label = 1
#@nav_dispaly_contest_label = 1
#@nav_dispaly_store_all_label = 1
#@nav_dispaly_user_label = 1
end
%>
<%= render :partial => "layouts/base_feedback" %>
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div class="welcome_logo">
@ -66,12 +37,8 @@
</ul>
</div>
<% end -%>
<%#= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
<%= render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
<%# 自建导航条在base页面中以 (@nav_dispaly......) 开头变量设定, 全局搜索即可发现 %>
</div>
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 0px;margin-top: -10px;"></div>
<div style="clear:left;"></div>
<script type="text/javascript">
function setMessageCount () {

View File

@ -0,0 +1,38 @@
<%= javascript_include_tag "feedback" %>
<div class="scrollsidebar" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
<div class="side_title">
<a title="<%= l(:button_hide) %>" class="close_btn">
<span>
</span>
</a>
</div>
<div class="side_center">
<div class="custom_service">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject, :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content, :required => true , :value => l(:label_feedback_value) %>
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();">
<%= l(:label_submit)%>
</a>
<% end %>
</div>
<div class="msgserver">
<a href="http://user.trustie.net/users/12/user_newfeedback" target="_blank">
<%= l(:label_technical_support) %>
黄井泉
</a>
<a href="http://user.trustie.net/users/34/user_newfeedback" target="_blank">
<%= l(:label_technical_support) %>
白&nbsp;&nbsp;&nbsp;羽
</a>
</div>
</div>
<div class="side_bottom"></div>
</div>
</div>
<div class="show_btn"><span>在线客服</span></div>
</div>

View File

@ -0,0 +1,29 @@
<div id="Footer">
<ul class="copyright">
<li class="fl mr10"><%= l(:label_hosted_organization)%><a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47" class=" ml10 c_dblue " target="_blank"><%= l(:label_hosted_by)%></a></li>
<li><a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="fl c_dblue mr30" target="_blank"><%= l(:label_sponsor)%></a></li>
<li class="fl mr30"><%= l(:label_rights_reserved)%> </li>
<li><a href="http://forge.trustie.net/projects/2/member" class="fl c_dblue mr30" target="_blank"><%= l(:label_contact_us)%></a></li>
<li><a href="http://www.miibeian.gov.cn/" class="fl c_dblue" target="_blank"><%= l(:label_license)%></a></li>
</ul>
<div class="cl"></div>
<ul class="footlogo">
<li class="fl mr20">
<%= link_to image_tag('/images/footer_logo/nudt.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank"%>
</li>
<li class="fl mr20">
<%= link_to image_tag('/images/footer_logo/peking_eecs.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_EECS)), "http://eecs.pku.edu.cn", :target => "_blank"%>
</li>
<li class="fl mr20">
<%= link_to image_tag('/images/footer_logo/buaa_scse.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank"%>
</li>
<li class="fl mr20">
<%= link_to image_tag('/images/footer_logo/iscas.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_CAS)), "http://www.iscas.ac.cn", :target => "_blank"%>
</li>
<li class="fl mr20">
<%= link_to image_tag('/images/footer_logo/inforbus.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_InforS)), "http://www.inforbus.com", :target => "_blank" %>
</li>
</ul>
</div><!--Footer end-->
<div class="cl"></div>

View File

@ -0,0 +1,61 @@
<div id="Header" >
<!-- logo -->
<div class="logo fl" >
<a href="#" target="_blank">
<%=link_to image_tag("/images/logo.png",weight:"35px", height: "30px")%>
</a>
</div>
<!-- 导航栏 -->
<div id="TopNav" class="fl">
<%= render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
</div>
<div id="TopUser" class="fr">
<div id="menu">
<ul class="menu">
<!--右侧登录、登出、注册按钮-->
<% if User.current.logged? -%>
<li id="current_user_li">
<%= link_to_user_header(User.current,false,:class =>'parent')%>
<ul id="user_sub_menu">
<% unless User.current.projects.empty? %>
<li id="my_projects_li">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain}, :class => "parent" %>
<ul id="my_projects_ul">
<% User.current.projects.each do |project| %>
<li title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %>
</li>
<% end %>
</ul>
</li>
<% end %>
<% if @show_course == 1 && User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) %>
<% user_course = get_user_course User.current%>
<% unless user_course.empty? %>
<li id="my_courses_li">
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id}, :class => "parent" %>
<ul id="my_courses_ul">
<% user_course.each do |course| %>
<li title="<%=course.name%>">
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id} %>
</li>
<% end %>
</ul>
</li>
<% end %>
<% end %>
<li>
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
</ul>
</li>
<% end -%>
<%= header_render_menu :account_menu -%>
</ul>
</div><!--topuser_nav end-->
</div>
</div>

View File

@ -1,9 +1,7 @@
<% @nav_dispaly_course_all_label = 1
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1 %>
<% course_model %>
<% teacher_num = teacherCount(@course) %>
<% student_num = studentCount(@course) %>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<!DOCTYPE html>
<html lang="en">
<head>
@ -15,353 +13,183 @@
<meta name="keywords" content="issue,bug,tracker"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses'%>
<%= javascript_include_tag "course","header" %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body class="<%= h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%= render :partial => 'layouts/base_header' %>
<div id="main">
<!--added by huang-->
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px;" rowspan="2">
<a href="http://<%= Setting.host_course%>" style="color: #15bccf;">
<body>
<div id="Container">
<%= render :partial => 'layouts/new_header' %>
<div class="cl"></div>
<div id="TopBar">
<div class="topbar_info02 fl">
<h2>
<a href="http://<%= Setting.host_course%>" target="_blank" class="c_blue">
<%= l(:label_courses_community)%>
</a>
</td>
<td style="color: #15bccf">
<strong>
<%= l(:label_user_location) %> :
</strong>
</td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#course_search_form").submit();}
}
</script>
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20, :style => "float:left" %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span" style="float: left"></span>
<%#= submit_tag l(:label_search), :class => "ButtonColor m3p10", :name => nil, :style => "float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" %>
</h2>
<p>
<%= l(:label_user_location) %> :
<%= link_to l(:field_homepage), home_path %>
>
<a href="http://<%= Setting.host_course%>">
<%=l(:label_courses_management_platform)%>
</a>
>
<%= link_to @course.name, nil %>
</p>
</div>
<div class="search fl">
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get, :class => "search_form") do %>
<%= text_field_tag 'name', params[:name], :placeholder => "课程名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>
<a href="#" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span" style="float: left"></span>
<% end %>
</div>
</div><!--TopBar end-->
<div class="cl"></div>
<div id="content">
<div id="LSide" class="fl">
<div class="project_info">
<div class="pr_info_logo fl mr10 mb5">
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
<% if get_avatar?(@course) %>
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
<% else %>
<%= link_to image_tag('../images/avatars/course/course.jpg', :width => "60", :height => "60"), course_path(@course) %>
<% end %>
</div>
</td>
</tr>
<tr>
<div class="pr_info_id fl mb5 f14">
ID:<%= @course.id%>
</div>
<div class="pr_info_join fl">
<% if is_teacher%>
<%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
<%= set_course_time @course%>
<%= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<% else%>
<%= join_in_course_header(@course, User.current) %>
<% end%>
</div>
<div class="cl"></div>
<td>
<p class="top-content-list">
<%= link_to l(:field_homepage), home_path %>
>
<a href="http://<%= Setting.host_course%>" class="link_other_item">
<%=l(:label_courses_management_platform)%>
<div >
<a class="pr_info_name fl c_dark fb" href="courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
<% if @course.is_public == 0%>
<span class="img_private ">
<%= l(:field_is_private)%>
</span>
<% end %>
</a>
>
<%= link_to @course.name, nil %>
</p>
</td>
</tr>
</table>
</div>
<!-- end -->
<!--course page-->
<div id="sidebar">
<div class="spaceleft">
<!--informations-->
<div class="inf_user_image">
<table>
<tr>
<td valign="top">
<% if get_avatar?(@course) %>
<%= image_tag(url_to_avatar(@course), :class => "avatar2") %>
<% else %>
<%= link_to image_tag('../images/avatars/course/course.jpg', :class => "avatar2"), course_path(@course) %>
<% end %>
<td>
<table>
<tr>
<td class="info-course">
<%= link_to @course.name,course_path(@course) %>
</td>
</tr>
<tr>
<td align="center">
<div id="join_in_course">
<% if User.current.logged? %>
<% if User.current.allowed_to?(:as_teacher,@course) %>
<%= link_to l(:button_configure), {:controller => 'courses', :action => 'settings', :id => @course} %>
<%= render :partial => 'courses/set_course_time', :locals => {:course => @course} %>
<% else %>
<%= join_in_course(@course, User.current) %>
<% end %>
<% end %>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--parameter-->
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<% files_count = @course.attachments.count %>
<td class="font_index">
<!-- 1 教师; 2 学生0 全部-->
<% if User.current.member_of_course?(@course) %>
<%= link_to "#{teacher_num}", course_member_path(@course, :role => 1), :course => '1' %>
<% else %>
<span>
<%= teacher_num %>
</span>
<% end%>
</td>
<td class="font_index">
<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %>
<%= link_to "#{student_num}", course_member_path(@course, :role => 2), :course => '1' %>
<% else %>
<span>
<%= student_num %>
</span>
<% end %>
</td>
<td class="font_index">
<%= link_to files_count, course_files_path(@course) %>
</td>
<tr class="font_aram">
<td align="center" width="80px" id="teacherCount">
<%= l(:label_x_base_courses_teacher, :count => teacher_num) %>
</td>
<td align="center" width="80px" id="studentCount">
<%= l(:label_x_base_courses_student, :count => student_num) %>
</td>
<td align="center" width="80px">
<%= l(:label_x_course_data, :count => files_count) %>
</td>
</tr>
</table>
<div class="user_underline"></div>
</div>
<!--info-->
<div class="inf_user_context">
<table>
<!-- addedby bai 教师姓名加超链接、加入开课时间、结课时间与课时 -->
<tr>
<td valign="top" style="padding-left: 8px; width:62px">
<%= l(:label_main_teacher) %> :
</td>
<td class="font_lighter_sidebar">
<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher)) %>
</td>
</tr>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;">
<%= l(:label_setup_time) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.setup_time %>
</td>
</tr>
<tr class="hidden">
<td valign="top" style="padding-left: 8px;">
<%= l(:label_endup_time) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.endup_time %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_class_period) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.class_period %>&nbsp;
<%= l(:label_class_hour) %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_main_term) %> :
</td>
<td class="font_lighter_sidebar">
<%= @course.time %>
<%= get_course_term_locales @course %>
</td>
</tr>
<!-- end -->
<% unless @course.teacher.user_extensions.nil? || @course.teacher.user_extensions.school.nil? %>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_course_organizers) %> :
</td>
<td class="font_lighter_sidebar">
<% if @course.school %>
<a href="http://<%= Setting.host_course%>/?school_id=<%= @course.school.id%>">
<%= @course.school %>
</a>
<% else%>
<% end %>
</td>
</tr>
<% else %>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_course_organizers) %> :
</td>
<td class="font_lighter_sidebar">
<%= l(:field_course_un) %>
</td>
</tr>
<% end %>
</table>
</div>
<div class="user_underline"></div>
<!--description-->
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_new_course_description) %>
</div>
<div style="padding-bottom: 8px">
<% if @course.description && !@course.description.blank? %>
<div class="font_lighter_sidebar" style="word-break:break-all; word-wrap:break-word;">
<%= textilizable @course.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_course" style="padding-left: 10px;">
<strong style="color: #068d9c">
<%= l(:label_create_time) %>
</strong>
<%= format_time(@course.created_at) %>
</div>
<div class="cl"></div>
<div class="pr_info_foot ">
<%= l(:label_account_identity_teacher)%><%= course_teacher_link teacher_num %>
<span>|&nbsp;</span>
<%= l(:label_account_identity_student)%><%= course_student_link student_num %>
<span>|&nbsp;</span>
<%= l(:project_module_attachments)%><%= link_to @course.attachments.count, course_files_path(@course), :class => 'info_foot_num c_blue' %></div>
<div class="cl"></div>
</div><!--课程信息 end-->
<div class="info_box">
<ul>
<li><%= l(:label_main_teacher)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
<li><%= l(:label_class_period)%> :&nbsp;&nbsp;<span ><%= @course.class_period %> <%= l(:label_class_hour) %></span></li>
<li><%= l(:label_main_term)%> :&nbsp;&nbsp;<span><%= @course.time %> <%= @course.term %></span></li>
<% if @course.school%>
<li><%= l(:label_course_organizers)%> :&nbsp;&nbsp;<a href="http://<%= Setting.host_course%>/?school_id=<%= @course.school.id%>" target="_blank" class="c_dblue"><%= @course.school%></a></li>
<% end%>
</ul>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<!-- added by william -for tag -->
<div class="user_tags">
<div id="tags">
<%= render :partial => 'tags/tag', :locals => {:obj => @course, :object_flag => "9"} %>
<div class="subNavBox">
<div class="subNav">
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
<!--暂时不显示课程动态数,优化后在显示-->
<%= link_to "(#{course_activity_count @course})", course_path(@course), :class => "subnav_num c_orange"%>
</div>
</div>
</div>
<div class="user_underline"></div>
<style type="text/css">
.polls_btn{ height:33px;border-top:0 solid #15bed1; border-bottom:1px solid #15bed1;border-right:1px solid #cee6e6; width:224px; padding:7px 0 0 15px; }
.polls_btn a{font-size:14px; color:#444444;font-weight:bold;}
.polls_btn span{ color:#15bed1; font-size:12px; font-weight:normal;}
.polls_btn a{ float:left;}
.polls_n{float: left;background: #ff5d31;color: #fff;width: 32px;padding-left: 2px;height: 7px;padding-bottom: 5px;padding-top: 3px;margin-top: -4px;margin-left: 3px; }
.polls_n p{ margin-top:-4px;}
.cl{ clear:both; overflow:hidden; }
</style>
<div class="polls_btn">
<!--<a href="#">问卷调查<span >12</span></a>-->
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id)%>
<div class="polls_n">
<p>NEW</p>
</div>
<div class="subNav">
<%= link_to l(:label_homework), homework_course_path(@course), :class => "f14 c_blue02"%>
<%= link_to "(#{@course.homeworks.count})", homework_course_path(@course), :class => "subnav_num c_orange"%>
<%= link_to( "+#{l(:label_course_homework_new)}", new_homework_course_path(@course), :class => 'subnav_green c_white') if is_teacher %>
</div>
<div class="subNav">
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.news.count})", course_news_index_path(@course), :class => "subnav_num c_orange"%>
<%= link_to( "+#{l(:label_course_news_new)}", new_course_news_path(@course), :class => 'subnav_green c_white') if is_teacher %>
</div>
<div class="subNav">
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %><%= link_to "(#{@course.attachments.count})", course_files_path(@course), :class => "subnav_num c_orange" %><%= link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white') if is_teacher %>
</div>
<div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.boards[0].topics.count})", course_boards_path(@course), :class => "subnav_num c_orange" %>
<%= link_to( "+#{l(:label_message_new)}", new_board_message_path(@course.boards[0]), :class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) %>
</div>
<div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange" %>
</div>
<div class="subNav">
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02"%>
<%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %>
<%= link_to( "+#{l(:label_new_poll)}", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'subnav_green c_white') if is_teacher %>
</div>
</div><!--项目侧导航 end-->
<div class="cl"></div>
</div>
</div>
</div>
<div id="content">
<div class="tabs_new">
<ul>
<li>
<%= link_to l(:label_course_overview), course_path(@course), :class => link_class(:overview) %>
</li>
<li>
<%= link_to l(:label_homework), homework_course_path(@course), :class => link_class([:homework,:new_homework,:edit]), :course_type => 1 %>
</li>
<li>
<%= link_to l(:label_course_file), course_files_path(@course), :class => link_class(:files) %>
</li>
<li>
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => link_class(:news) %>
</li>
<li>
<%= link_to l(:label_course_board), {:controller => 'boards', :action => 'index', :course_id => @course}, :class => link_class(:boards) %>
</li>
<li>
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => link_class(:feedback) %>
</li>
</ul>
</div>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<!--gcm-->
<div class="project_intro">
<div id="course_description" class="course_description">
<h4 ><%= l(:label_course_brief_introduction)%></h4>
<div id="course_description_content">
<%= textilizable(@course.description) if @course.description && !@course.description.blank? %>
</div>
</div>
<div class="lg-foot" id="lg-foot" onclick="show_more_msg();">
<%= l(:label_expend_information)%>
<span class="g-arr-down">
<img src="/images/jiantou.jpg" width="12" height="6" />
</span>
</div>
</div><!--项目简介 end-->
<div class="project_Label">
<h4 class="mb5" ><%= l(:label_tag)%>:</h4>
<div class="tag_h" >
<%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
</div>
<div class="cl"></div>
</div><!--项目标签 end-->
</div><!--LSide end-->
</div>
<!--gcm move it mistakenly-->
<%= render :partial => 'layouts/base_footer' %>
</div>
<div id="RSide" class="fl">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
</div>
<div style="clear:both;"></div>
</div><!--Content end-->
<div class="cl"></div>
<%= render :partial => 'layouts/new_footer' %>
<div class="cl"></div>
</div><!--Container end-->
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;">
<span>
<%= l(:label_loading) %>
</span>
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</div>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="<%= current_language %>">
<head>
<meta charset="utf-8" />
<title><%=h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<body class="<%=h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%=render :partial => 'layouts/base_header'%>
<div id="main" class="nosidebar">
<div id="content_">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%=render :partial => 'layouts/base_footer'%>
</div>
</div>
</div>
<div id="ajax-indicator" style="display:none;">
<span>
<%= l(:label_loading) %>
</span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -0,0 +1,45 @@
<% course_model %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
<%= h html_title %>
</title>
<meta name="description" content="<%= Redmine::Info.app_name %>"/>
<meta name="keywords" content="issue,bug,tracker"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses'%>
<%= javascript_include_tag "course","header" %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body>
<div id="Container">
<%= render :partial => 'layouts/new_header' %>
<div class="cl"></div>
<div id="content02" >
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
</div><!--Content end-->
<div class="cl"></div>
<%= render :partial => 'layouts/new_footer' %>
<div class="cl"></div>
</div><!--Container end-->
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -0,0 +1,15 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_board_plural) %></h2>
</div>
<div class="talk_new ml15">
<p class="talk_top"><%= l(:label_message_new) %></p>
<ul>
<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f,:is_new => true} %>
<a href="#" onclick="submitCoursesBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%#= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form' ,target='preview',{:class => 'blue_btn grey_btn fl c_white'} )%>
<%= link_to l(:button_cancel), course_boards_path(@course), :class => "blue_btn grey_btn fl c_white"%>
<% end %>
</ul>
</div>
<div id="preview" class="wiki"></div>

View File

@ -1,196 +1,100 @@
<style type="text/css">
.lz {
position: relative;
min-height: 200px;
margin: 10px 2px;
border-radius: 5px;
box-shadow: 1px 1px 6px #97EBF4;
}
.lz-left {
float: left;
margin: 2%;
padding: 0;
}
.memo-section {
width: auto;
margin-left: 15%;
padding-top: 1%;
border-left: 2px dotted #EEE;/*#8BE9F3;*/
}
.memo-title {
margin: 1em 0;
padding-left: 1%;
padding-bottom: 1%;
font-weight: bold;
border-bottom: 1px dashed rgb(204, 204, 204);
}
.memo-content {
padding: 1%;
margin: 1%;
margin-bottom: 40px;
background-color: #F6F6F6;
white-space: normal;
/*word-break: break-all; */
word-wrap: break-word;
}
.memo-timestamp {
position: absolute;
bottom: 0px;
/*right: 0;*/
left: 0;
margin: 20px;
}
.replies {
float: right;
/*max-width: 90%;*/
}
.reply-box {
float: right;
width: 640px;
padding: 3%;
/*border: 2px solid #C6F3F9;*/
border-top: 2px double #C6F3F9;
/*border-radius: 10px;*/
}
</style>
<div class="lz">
<!-- 在这里添加赞和踩-->
<span id="praise_tread" style="float: right">
<%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @topic,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
</span>
<div class="contextual">
<%= watcher_link(@topic, User.current) %>
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => @topic},
:remote => true,
:method => 'get',
:class => 'icon icon-comment',
:remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'icon icon-edit'
) if @message.course_editable_by?(User.current) %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del'
) if @message.course_destroyable_by?(User.current) %>
</div>
<div class="lz-left">
<div class="">
<%= link_to image_tag(url_to_avatar(@topic.author), :class => "avatar"), user_path(@topic.author) %>
</div>
<p class="">
<%= link_to @topic.author, user_path(@topic.author) %>
</p>
</div>
<div class="memo-section">
<div class="memo-title <%= @topic.sticky? ? 'sticky' : '' %> <%= @topic.locked? ? 'locked' : '' %>" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<% if @project %>
<%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, project_boards_path(@topic.project),title: @topic.subject.to_s %>
<% elsif @course %>
<%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, course_boards_path(@topic.course),title: @topic.subject.to_s %>
<% end %>
</div>
<div class="memo-content">
<%= textilizable(@topic, :content) %>
<%= link_to_attachments @topic, :author => false %>
</div>
<div class="memo-timestamp">
<div style="float: left">
<%= authoring @topic.created_on, @topic.author %>
</div>
<div style="float: right">
<% if User.current.logged? %>
<%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %>
<% else %>
<%= link_to l(:button_reply), signin_path %>
<% end %>
</div>
</div>
</div>
<br />
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_board) %></h2>
</div>
<div class="problem_main">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %></div>
<div class="talk_txt fl">
<p class="problem_tit fl fb" ><%= link_to @topic.subject, course_boards_path(@topic.course),title: @topic.subject.to_s %></p>
<br/>
<p>由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %> 添加于<%= format_time(@topic.created_on) %></p>
</div>
<!-- <a class="talk_edit fr">删除</a><a class="talk_edit fr">编辑</a><a class="talk_edit fr">置顶</a> -->
<%#= watcher_link(@topic, User.current) %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'talk_edit fr'
) if @message.course_editable_by?(User.current) %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr'
) if @message.course_destroyable_by?(User.current) %>
<div class="cl"></div>
<div class="talk_info mb10"><%= textilizable(@topic, :content) %></div>
<div class="talk_info mb10"><%= link_to_attachments_course @topic, :author => false %></div>
<!-- <a href="#" class=" link_file ml60">附件爱覅俄方if.zip(27.5kB)</a>-->
<div class="cl"></div>
<% if User.current.logged? %>
<%= toggle_link l(:button_reply), "reply", :focus => 'message_content',:class => 'talk_edit fr' %>
<% else %>
<%= link_to l(:button_reply), signin_path,:class => 'talk_edit fr' %>
<% end %>
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => @topic},
:remote => true,
:method => 'get',
:class => 'talk_edit fr',
:remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% unless @replies.empty? %>
<br />
<br />
<br />
<br />
<h3 class="comments">
<%= l(:label_reply_plural) %>
(<%= @reply_count %>)
</h3>
<% reply_count = 0 %>
<% @replies.each do |message| %>
<div class="message reply" id="<%= "message-#{message.id}" %>">
<table class="borad-text-list">
<tr>
<td rowspan="3" valign="top" width="60px">
<%= link_to image_tag(url_to_avatar(message.author), :class => "avatar"), user_path(message.author) %>
</td>
<td>
<div class="contextual-borad">
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => message},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => message},
:title => l(:button_edit)
) if message.course_editable_by?(User.current) %>
<%= link_to(
#image_tag('delete.png'),
l(:button_delete),
{:action => 'destroy', :id => message},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.course_destroyable_by?(User.current) %>
</div></td>
</tr>
<tr>
<td class="comments">
<div class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;">
<%= textilizable message,:content,:attachments => message.attachments %>
</div>
<%= link_to_attachments message, :author => false %>
</td>
</tr>
<tr>
<td class="font_lighter" style="float: left">
<%= authoring message.created_on, message.author %>
</td>
</tr>
</table>
</div>
<div class="ping_C mb10" id="<%= "message-#{message.id}" %>">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %></div>
<div class="ping_discon">
<div class="ping_distop">
<%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %>
<span class="c_grey fr"><%= format_time(message.created_on) %></span>
<div class="cl"></div>
<p><%= textilizable message,:content,:attachments => message.attachments %></p>
<%= link_to_attachments_course message, :author => false %>
</div>
<div class="ping_disfoot">
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => message},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => message},
:title => l(:button_edit)
) if message.course_editable_by?(User.current) %>
<%= link_to(
#image_tag('delete.png'),
l(:button_delete),
{:action => 'destroy', :id => message},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div><!---留言内容-->
<% end %>
<div class="pagination">
<%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %>
</div>
<% end %>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div id="reply" style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
<input type="button" class="enterprise" value="<%=l(:button_submit) %>" onclick="submit_message_replay();" >
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<a href="#" onclick="submit_message_replay();"class="blue_btn fl c_white" style="margin-left: 50px;"><%= l(:button_submit)%></a>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% html_title @topic.subject %>
<script type="text/javascript">
@ -202,7 +106,7 @@
{
if(flag)
{
$("#message-form").submit();
$("#message_form").submit();
}
}
function regexContent()

View File

@ -70,8 +70,8 @@
<%= l(:field_description) %>
<span class="required"> *&nbsp;&nbsp;</span>
</label>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
</p>
<p>
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>

View File

@ -0,0 +1,44 @@
<%= error_messages_for 'message' %>
<% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<% if replying %>
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
<% else %>
<%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
<% end %>
<p id="subject_span" class="ml55"></p>
</li>
<li class="ml60 mb5">
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<% if @message.safe_attribute? 'locked' %>
<%= f.check_box :locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<% end %>
<div class="cl"></div>
</li>
<li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<div class="cl"></div>
<p id="message_content_span" class="ml55"></p>
</li>
<div class="cl"></div>
<li>
<label class="fl">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<div class="fl">
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
</div>
</li>
<li >
<div class="cl"></div>
</li>

View File

@ -1,23 +1,45 @@
<% if @message.project %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_board) %></h2>
</div>
<% if @message.project %>
<%= board_breadcrumb(@message) %>
<h3><%= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%=h @topic.subject %></span></h3>
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<%= render :partial => 'form',
:locals => {:f => f, :replying => !@message.parent.nil?} %>
<a href="#" onclick="$('#message-form').submit();" class="ButtonColor m3p10">
<%= l(:button_save) %>
</a>
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "ButtonColor m3p10" %>
<% end %>
<% elsif @message.course %>
<%= course_board_breadcrumb(@message) %>
<%#= course_board_breadcrumb(@message) %>
<div class="talk_new ml15">
<ul>
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<%= render :partial => 'form_course',
:locals => {:f => f, :replying => !@message.parent.nil?} %>
<a href="#" onclick="submitCoursesBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %>
<% end %>
</ul>
</div>
<% end %>
<h3><%= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%=h @topic.subject %></span></h3>
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<%= render :partial => 'form',
:locals => {:f => f, :replying => !@message.parent.nil?} %>
<a href="#" onclick="if(regexSubject()&&regexContent()){$('#message-form').submit();}" class="ButtonColor m3p10">
<%= l(:button_save) %>
</a>
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "ButtonColor m3p10" %>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -4,18 +4,15 @@
&#187;
<%= l(:label_message_new) %>
</h3>
<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f,:is_new => true} %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%>
<% end %>
<div id="preview" class="wiki"></div>
<% elsif @course %>
<h3>
<%= link_to h(@board.name), :controller => 'boards', :action => 'show', :course_id => @course, :id => @board %>
&#187;
<%= l(:label_message_new) %>
</h3>
<%= render :partial => 'course_new' %>
<% end %>
<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -1,26 +1,27 @@
<%= error_messages_for @news %>
<div class="add_frame_header" >
<%= is_new ? l(:bale_news_notice):l(:bale_edit_notice)%>
</div>
<div class="box tabular">
<p>
<%= f.text_field :title, :required => true, :size => 60, :style => "width:468px;", :onkeyup => "regexTitle();", :maxlength => 60 %>
</p>
<P>
<span id="title_notice_span">(60个字符以内)</span>
</P>
<p>
<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:470px;", :onkeyup => "regexDescription();" %>
</p>
<P>
<span id="description_notice_span"></span>
</P>
<p id="attachments_form" style="margin-left:-10px;">
<label style="padding-right: 15px;">
<%= l(:label_attachment_plural) %>
</label>
<%= render :partial => 'attachments/form', :locals => {:container => @news} %>
</p>
</div>
<%= wikitoolbar_for 'news_description'%>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<p id="title_notice_span" class="ml55"></p>
</li>
<li class="ml45">
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<textarea id="news_description" name="news[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl" onkeyup="regexDescription();" maxlength="6000"><%= is_new ? '' : @news.description %></textarea>
<p id="description_notice_span" class="ml55"></p>
</li>
<div class="cl"></div>
<li class="ml45">
<label class="fl">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
<div class="cl"></div>
</li>
<li class=" ml90" >
<% if is_new %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
<% else %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %>
<% end %>
<div class="cl"></div>
</li>
<!-- <#%= wikitoolbar_for 'news_description'%>-->

View File

@ -3,85 +3,41 @@
label_tips = l(:label_course_news)
%>
<script type="text/javascript">
function regexTitle()
{
var name = $("#news_title").val();
if(name.length ==0)
{
$("#title_notice_span").text("标题不能为空");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
else if(name.length <= 60)
{
$("#title_notice_span").text("填写正确");
$("#title_notice_span").css('color','#008000');
return true;
}
else
{
$("#title_notice_span").text("标题超过60个字符");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
}
function regexDescription()
{
var name = $("#news_description").val();
if(name.length ==0)
{
$("#description_notice_span").text("描述不能为空");
$("#description_notice_span").css('color','#ff0000');
$("#description_notice_span").focus();
return false;
}
else
{
$("#description_notice_span").text("填写正确");
$("#description_notice_span").css('color','#008000');
return true;
}
}
function submitNews()
{
if(regexTitle() && regexDescription())
{
$("#news-form").submit();
}
}
<div class="project_r_h">
<h2 class="project_h2"><%= label_tips %></h2>
</div>
<div class="talk_top">
<p class="fl"><%= l(:label_total_news) %><span><%= @news_count %></span><%= l(:label_course_news_count) %></p>
<% if @course && User.current.allowed_to?(:manage_news, @course) %>
<%= link_to(btn_tips,new_course_news_path(@course),
:class => 'problem_new_btn fl c_dorange')%>
<div class="cl"></div>
function submitFocus(obj)
{
$(obj).focus();
}
</script>
<% end %>
<div class="cl"></div>
</div>
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
<%= label_tips %>
</span>
<% if @course && User.current.allowed_to?(:manage_news, @course) %>
<%= link_to(btn_tips, new_course_news_path(@course),
<!-- <%# if @course && User.current.allowed_to?(:manage_news, @course) %>
<%#= link_to(btn_tips, new_course_news_path(@course),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
<div id="add-news" class="add_frame" style="display:none;">
<%= labelled_form_for @news, :url => course_news_index_path(@course),
<%#= labelled_form_for @news, :url => course_news_index_path(@course),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %>
<%#= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %>
<%#= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path, 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %>
<% end if @course %>
<%#= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %>
<%# end if @course %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<%# end %>-->
<div>
<% if @newss.empty? %>
<p class="nodata">
@ -89,67 +45,30 @@
</p>
<% else %>
<% @newss.each do |news| %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" width="50">
<%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %>
</td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top">
<strong>
<%= link_to_user(news.author) if news.respond_to?(:author) %>
</strong>
<span style="margin-left: 4px;" class="font_lighter">
<%= l(:label_project_notice) %>
</span>
<span>
<%= link_to h(news.title), news_path(news) %>
</span>
<span style="float: right">
<%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @couese) %>
</span>
</td>
</tr>
<tr>
<td colspan="2" width="580px">
<span class="font_description">
<%= textilizable(news, :description) %>
</span>
</td>
</tr>
<tr>
<td align="left">
<span class="font_lighter">
<%= l :label_update_time %>
&nbsp;
<%= format_time(news.created_on) %>
</span>
</td>
<td width="350" align="right" class="a">
<%= link_to l(:label_project_newother), news_path(news) %>
<%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_release_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
<div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="news_description mt5"><%= news.description %><br /> <%= l(:label_create_time) %> <%= format_time(news.created_on) %></p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
</div>
<div class="cl"></div>
</div><!--problem_main end-->
<% end %>
<% end %>
</div>
<!--end-->
<div style="padding-right: 10px">
<div class="pagination">
<ul>
<%= pagination_links_full @news_pages %>
</ul>
</div>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:course_id => @course, :key => User.current.rss_key} %>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:course_id => @course, :key => User.current.rss_key} %>
<%# end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
@ -171,4 +90,13 @@
});
});
});
$(function(){
$('.news_description').each(function () {
if($(this).height() >= 38)
{
$('#news_foot_'+$(this).attr('id').replace('news_description_','')).css("display","block");
}
}
)
});
</script>

View File

@ -49,92 +49,89 @@
$("#news-form").submit();
}
}
function submitComment()
{
$("#add_comment_form").submit();
}
function clearMessage()
{
$("#comment_comments").val("");
}
</script>
<div class="contextual">
<%= watcher_link(@news, User.current) %>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'icon icon-edit',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %>
<%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @course) %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_news) %></h2>
</div>
<h3><strong><%=h @news.title %></strong></h3>
<% if authorize_for_course('news', 'edit') %>
<div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %>
<%#= submit_tag l(:button_save) %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'ButtonColor m3p10' %>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<div id="comments" style="margin-bottom:16px;">
<div style="margin:15px">
<span class="font_description"> <%= textilizable(@news, :description) %> </span>
<br/>
<%= link_to_attachments @news %>
<br/>
<!--add comment-->
<% if @news.commentable? %>
<p>
<%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %>
</p>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
<div class="box">
<%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'comment_comments' %>
</div>
<p>
<%= submit_tag l(:button_add) %>
</p>
<% end %>
<% end %>
<% html_title @news.title -%>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<!--dispaly comments-->
<div class="line_heng"></div>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<h4 class="r_txt_tit mb5"> <%=h @news.title %></h4>
<%#= watcher_link(@news, User.current) %>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'talk_edit fr',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %>
<%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
<div class="cl"></div>
<div class="mb5"><%= textilizable(@news, :description) %><br /> <%= l(:label_create_time) %> <%= format_time(@news.created_on) %></div>
<%= link_to_attachments_course @news %>
<!--<a href="#" class=" link_file">附件爱覅俄方if.zip(27.5kB)</a> -->
</div>
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
<div class="cl"></div>
</div>
<% if @news.commentable? %>
<div class="msg_box">
<h4><%= l(:label_comment_add) %></h4>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
<div class="box">
<%= text_area 'comment', 'comments', :placeholder=>"最多250个字"%>
</div>
<p>
<a href="#" class="grey_btn fr ml10" onclick="clearMessage();"><%= l(:label_cancel_with_space) %></a>
<a href="#" class="blue_btn fr" onclick="submitComment();"><%= l(:label_comment_with_space) %></a>
</p>
<% end %>
</div>
<% end %>
<% comments = @comments.reverse %>
<% comments.each do |comment| %>
<% next if comment.new_record? %>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(comment.author), :class => "avatar")%></td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= link_to_user(comment.author) if comment.respond_to?(:author) %> </strong><span class="font_lighter"><%= l(:label_project_newadd) %></span><%= l(:label_comment_plural) %></td>
</tr>
<tr>
<td colspan="2" width="580px" >
<span class="font_description">
<%= textilizable(comment.comments) %>
</span>
</td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= format_time(comment.created_on) %></span></td>
<td width="200" align="right" class="a"><%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
</tr>
</table></td>
</tr>
</table>
<div class="ping_C mb10">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%></div>
<div class="ping_discon">
<div class="ping_distop">
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><span class="c_grey fr"><%= format_time(comment.created_on) %></span>
<div class="cl"></div>
<p><%= textilizable(comment.comments) %></p>
</div>
<div class="ping_disfoot"><%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
</div>
</div>
<div class="cl"></div>
</div>
<% end if @comments.any? %>
</div>
<!--problem_main end-->
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title @news.title -%>

View File

@ -1,4 +1,8 @@
<!-- <h3><%#=l(:label_news_new)%></h3> -->
<%
btn_tips = l(:label_news_notice)
label_tips = l(:label_course_news)
%>
<% if @project %>
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => {:id => 'news-form', :multipart => true} do |f| %>
@ -7,11 +11,22 @@
<%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<% end %>
<% elsif @course %>
<%= labelled_form_for @news, :url => course_news_index_path(@course),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/form', :locals => {:f => f} %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%#= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<% end %>
<div class="project_r_h">
<h2 class="project_h2"><%= label_tips %></h2>
</div>
<div class="hwork_new">
<%= error_messages_for @news %>
<p class="talk_top pl15" >
<%= l(:bale_news_notice)%>
</p>
<ul>
<%= labelled_form_for @news, :url => course_news_index_path(@course),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %>
<% end if @course %>
</ul>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -7,21 +7,21 @@
<td class="td287"><%= l(:label_poll_proportion) %> </td>
</tr>
<% poll_question.poll_answers.each do |poll_answer| %>
<tr>
<td class="td327"><%= poll_answer.answer_text %> </td>
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
<td class="td287">
<div class="Bar">
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
</div>
<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%</td>
</tr>
<tr>
<td class="td327"><%= poll_answer.answer_text %> </td>
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
<td class="td287">
<div class="Bar">
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
</div>
<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%</td>
</tr>
<% end %>
<tr class="table_bluebg">
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
<td class="td42"><%= total_answer(poll_question.id) %></td>
<td class="td287">&nbsp; </td>
</tr>
<tr class="table_bluebg">
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
<td class="td42"><%= total_answer(poll_question.id) %></td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>
</table>
</div>

View File

@ -7,7 +7,7 @@
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item'>" +
"<label>选项<span class='ur_index'></span></label>" +
"<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
@ -29,7 +29,7 @@
<ul id="poll_answers_<%=poll_question.id%>">
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.answer_text%>"/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
@ -39,7 +39,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -6,7 +6,7 @@
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item'>" +
"<label>选项<span class='ur_index'></span></label>" +
"<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
@ -17,6 +17,7 @@
</script>
<div class="ur_editor checkbox">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多选题标题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
@ -26,7 +27,7 @@
<ul id="poll_answers_<%=poll_question.id%>">
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.answer_text%>"/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
@ -36,7 +37,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -12,7 +12,7 @@
</textarea>
</div>
<div class="ur_editor_footer" style="padding-top: 10px;">
<a class="btn_submit" data-button="ok" onclick="pollsSubmit($(this));">
<a class="btn_submit c_white" data-button="ok" onclick="pollsSubmit($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">

View File

@ -20,7 +20,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<a class="btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -16,7 +16,7 @@
<label for="ur_question_require">必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<a class="btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -11,21 +11,21 @@
<div class="ur_editor_content">
<ul>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
@ -34,7 +34,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -10,21 +10,21 @@
<div class="ur_editor_content">
<ul>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
@ -33,7 +33,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -13,7 +13,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -8,7 +8,7 @@
<label for="ur_question_require">必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -1,91 +1,51 @@
<% has_commit = has_commit_poll?(poll.id ,User.current)%>
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<li title="<%= poll.polls_name %>">
<% if @is_teacher %>
<% if has_commit %>
<sapn class="polls_title fl">
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %>
</sapn>
<% else %>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl" %>
<% end %>
<% else %>
<% if has_commit && poll.polls_status == 2 %>
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 500px;width: auto;" %>
<% elsif !has_commit && poll.polls_status == 2 %>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %>
<% end %>
<% end %>
</li>
<% if !@is_teacher && has_commit && poll.polls_status == 2%>
<li class="pollsbtn_tip fl ml5">已答</li>
<% end %>
<%if @is_teacher%>
<% if poll.polls_status == 1%>
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li>
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
</li>
<% end%>
<% end%>
<%if @is_teacher %>
<% if poll.polls_status == 1 %>
<li>
<a href="#" class="pollsbtn btn_pu fl ml5" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>);">
发布问卷
</a>
</li>
<% elsif poll.polls_status == 2%>
<li>
<a href="#" class="pollsbtn btn_de fl ml5" onclick="republish_poll(<%= poll.id%>);">
取消发布
</a>
</li>
<% else%>
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >
发布问卷
</li>
<% end%>
<% end%>
<li>
<% if @is_teacher %>
<!--新建状态的问卷可删除-->
<%= link_to(l(:button_delete), poll,
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml15 mr10") %>
<% end%>
</li>
<% if @is_teacher%>
<% if poll.polls_status == 1 %>
<li>
<%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml15"%>
</li>
<% else%>
<li class="polls_de_grey fr ml15">
编辑
</li>
<% end%>
<% end%>
<% if @is_teacher%>
<% if poll.polls_status == 2 %>
<li>
<a class="polls_de fr ml15" onclick="close_poll(<%= poll.id%>);">关闭</a>
</li>
<li title="<%= poll.polls_name %>">
<% if has_commit %>
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
<% else %>
<li class="polls_de_grey fr ml15">
关闭
</li>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
<% end %>
</li>
<% if poll.polls_status == 1%>
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%></li>
<% end%>
<% if poll.polls_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>);">发布问卷</a></li>
<% elsif poll.polls_status == 2%>
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_poll(<%= poll.id%>);">取消发布</a></li>
<% else%>
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布问卷</li>
<% end%>
<%= link_to(l(:button_delete), poll,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
<% if poll.polls_status == 1 %>
<li><%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%></li>
<% else%>
<li class="polls_de_grey fr ml5">编辑</li>
<% end%>
<% if poll.polls_status == 2 %>
<li><a class="polls_de fr ml5" onclick="close_poll(<%= poll.id%>);" href="javascript:">关闭</a></li>
<% else %>
<li class="polls_de_grey fr ml5">关闭</li>
<% end%>
<li class="polls_date fr"><%= format_date poll.created_at.to_date%></li>
<% else%>
<% if poll.polls_status == 2%>
<% 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 poll_name, poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue"%>
<%end%>
<% end%>
<% end %>
<li class="polls_date fr mr10">
<%= format_time poll.created_at%>
</li>
<li class="polls_date fr mr10"><%= format_date poll.created_at.to_date%></li>
<% end%>

View File

@ -1,106 +1,97 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>问卷调查_问卷编辑</title>
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<%#= javascript_include_tag "polls" %>
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript">
//编辑问卷描述之后
function edit_head(){
$("#polls_description").val($("#polls_description_div").html());
}
<script type="text/javascript">
//编辑问卷描述之后
function edit_head(){
$("#polls_description").val($("#polls_description_div").html());
}
function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus();
}
function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title").focus();
}
function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title").focus();
}
function add_mulit(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus();
}
function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus();
}
function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title").focus();
}
function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title").focus();
}
function add_mulit(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus();
}
//添加标题时确定按钮
function add_poll_question(doc)
//添加标题时确定按钮
function add_poll_question(doc)
{
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//修改标题时确定按钮
function edit_poll_question(doc,id)
{
var title = $.trim($("#poll_questions_title_" + id).val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){
var title = $.trim($("#polls_title").val());
if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().parent().submit();}
}
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
//
function pollQuestionCancel(question_id){
$("#show_poll_questions_"+question_id).show();
$("#edit_poll_questions_"+question_id).hide();
}
function pollQuestionEdit(question_id){
$("#show_poll_questions_"+question_id).hide();
$("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus();
}
//单选题
function add_single_answer(doc)
{
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
}
function remove_single_answer(doc)
{
if(doc.parent().siblings("li").length == 0)
{
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
alert("选择题至少有一个选项");
}
//修改标题时确定按钮
function edit_poll_question(doc,id)
else
{
var title = $.trim($("#poll_questions_title_" + id).val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
doc.parent().remove();
}
}
//问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){
var title = $.trim($("#polls_title").val());
if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().parent().submit();}
}
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
//
function pollQuestionCancel(question_id){
$("#show_poll_questions_"+question_id).show();
$("#edit_poll_questions_"+question_id).hide();
}
function pollQuestionEdit(question_id){
$("#show_poll_questions_"+question_id).hide();
$("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus();
}
//单选题
function add_single_answer(doc)
function poll_submit()
{
var title = $.trim($("#polls_name_h").html());
if(title.length == 0)
{
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span></label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
alert("问卷标题不能为空");
}
function remove_single_answer(doc)
{
if(doc.parent().siblings("li").length == 0)
{
alert("选择题至少有一个选项");
}
else
{
doc.parent().remove();
}
else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
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","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function poll_submit()
{
var title = $.trim($("#polls_name_h").html());
if(title.length == 0)
{
alert("问卷标题不能为空");
}
else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='#' 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","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
}
</script>
</head>
<body>
}
</script>
<div class=" polls_content polls_edit" id="polls">
<!-- 头部 -->
@ -116,7 +107,7 @@
<%= render :partial => 'poll_content', :locals => {:poll => @poll}%>
</div>
<div class="tabs_1">
<div class="tabs">
<ul class="tabs_list">
<li class="tab_item02 " >
<a title="<%= l(:label_MC) %>" class="tab_icon icon_radio" onclick="add_MC();">
@ -150,9 +141,11 @@
<a class="ur_button_submit" onclick="poll_submit();">
<%= l(:label_memo_create)%>
</a>
<div class="polls_cha">
<input type="checkbox" name="" value="" >
<label for="">允许学生查看调查结果</label>
</div>
</div>
<div class="cl"></div>
</div><!--编辑end-->
</body>
</html>

View File

@ -9,7 +9,7 @@
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>">
<ul id="polls_<%= poll.id %>" class="polls_list_ul">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
</ul>
<div class="cl"></div>

View File

@ -1,16 +1,20 @@
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<table border="0" cellspacing="0" cellpadding="0" class="full_width">
<tbody>
<tr class="table_bluebg">
<td class="td327" ><%= l(:label_answer) %> </td>
<td class="td_full"><%= l(:label_answer) %> </td>
</tr>
<% poll_question.poll_votes.each do |poll_vote| %>
<tr>
<td class="td111"><%= poll_vote.vote_text.html_safe %> </td>
<td class="td_full"><%= poll_vote.vote_text.html_safe %> </td>
</tr>
<% end %>
<tr class="table_bluebg">
<td class="td327"><%= l(:label_poll_answer_valid_result) %> <%= l(:label_answer_total) %><%= poll_question.poll_votes.count %></td>
<td class="td_full">
<%= l(:label_poll_answer_valid_result) %>
<%= l(:label_answer_total) %>
<%= poll_question.poll_votes.count %>
</td>
</tr>
</tbody>
</table>

View File

@ -1,8 +1,6 @@
<div class="ur_page_head ur_editor02"><!--头部显示 start-->
<a href="#" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
<h1 class="ur_page_title" id="polls_name_h">
<%= poll.polls_name%>
</h1>
<div class="ur_page_head ur_editor02" ><!--头部显示 start-->
<a href="javascript:" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
<h1 class="ur_page_title" id="polls_name_h"><%= poll.polls_name%></h1>
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
<div class="cl"></div>
</div><!--头部显示 end-->

View File

@ -1,9 +1,9 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>');
showModal('ajax-modal', '400px');
showModal('ajax-modal', '250px');
$('#ajax-modal').css('height','100px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='#' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
"<a href='javascript:' onclick='hidden_atert_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","");
$('#ajax-modal').parent().addClass("alert_box");

View File

@ -50,7 +50,7 @@
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
"<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","");
$('#ajax-modal').parent().addClass("popbox_polls");
@ -75,12 +75,12 @@
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
"<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","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
</script>
<div class="polls_content" id="polls" style="width:677px;">
<div class="polls_content02" id="polls">
<%= render :partial => 'poll_list'%>
</div><!--问卷内容end-->

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