Merge branch 'szzh' into sw_new_course

sw_new_course
sw 10 years ago
commit 522fcbf755

@ -10,7 +10,7 @@ module Mobile
else else
f[field] f[field]
end end
elsif f.is_a?(::Bid) elsif f.is_a?(::HomeworkCommon)
if f.respond_to?(field) if f.respond_to?(field)
f.send(field) f.send(field)
else else

@ -15,11 +15,10 @@ class ActivityNotifysController < ApplicationController
end end
if( query != nil ) if( query != nil )
logger.info('xxoo')
limit = 10; limit = 10;
@obj_count = query.count(); @obj_count = query.count();
@obj_pages = Paginator.new @obj_count,limit,params['page'] @obj_pages = Paginator.new @obj_count,limit,params['page']
list = query.order('id desc').limit(limit).offset(@obj_pages.offset).all(); list = query.order('is_read,id desc').limit(limit).offset(@obj_pages.offset).all();
events=[]; events=[];
for item in list for item in list
event = item.activity; event = item.activity;
@ -29,7 +28,6 @@ class ActivityNotifysController < ApplicationController
end end
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
@controller_name = 'ActivityNotifys' @controller_name = 'ActivityNotifys'
logger.info('aavv')
end end
respond_to do |format| respond_to do |format|
format.html {render :template => 'courses/show', :layout => 'base_courses'} format.html {render :template => 'courses/show', :layout => 'base_courses'}

@ -23,6 +23,7 @@ class AttachmentsController < ApplicationController
before_filter :delete_authorize, :only => [:destroy] before_filter :delete_authorize, :only => [:destroy]
before_filter :authorize_global, :only => [:upload] before_filter :authorize_global, :only => [:upload]
before_filter :authorize_attachment_download1, :only => [:download] before_filter :authorize_attachment_download1, :only => [:download]
before_filter :has_login
#before_filter :login_without_softapplication, only: [:download] #before_filter :login_without_softapplication, only: [:download]
accept_api_auth :show, :download, :upload accept_api_auth :show, :download, :upload
require 'iconv' require 'iconv'
@ -62,6 +63,16 @@ class AttachmentsController < ApplicationController
render :action => 'file' render :action => 'file'
end end
def pdf?(file)
file.downcase.end_with?(".pdf")
end
def direct_download
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'attachment' #inline can open in browser
end
def download def download
# modify by nwb # modify by nwb
# 下载添加权限设置 # 下载添加权限设置
@ -69,20 +80,30 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download @attachment.increment_download
if stale?(:etag => @attachment.digest) if stale?(:etag => @attachment.digest)
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".html") if params[:preview] == 'true'
if File.exist?(convered_file) convered_file = @attachment.diskfile
send_file convered_file, :type => 'text/html; charset=utf-8', :disposition => 'inline' #如果本身不是pdf文件则先寻找是不是已转换化如果没有则转化
unless pdf?(convered_file)
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
unless File.exist?(convered_file)
office = Trustie::Utils::Office.new(@attachment.diskfile)
office.conver(convered_file)
end
end
if File.exist?(convered_file) && pdf?(convered_file)
send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
else
direct_download
end
else else
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), direct_download
:type => detect_content_type(@attachment),
:disposition => 'attachment' #inline can open in browser
end end
end end
else else
render_403 :message => :notice_not_authorized render_403 :message => :notice_not_authorized
end end
rescue => e rescue => e
redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html" redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
end end
#更新资源文件类型 #更新资源文件类型
@ -196,13 +217,13 @@ class AttachmentsController < ApplicationController
if @attachment.container.is_a?(News) if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) } format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @attachment.container.is_a?(StudentWorksScore) elsif @attachment.container.is_a?(StudentWorksScore)
@is_destroy = true #根据ID删除页面对应的数据js刷新页面 @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据js刷新页面
format.js format.js
elsif @attachment.container.is_a?(HomeworkCommon) elsif @attachment.container.is_a?(HomeworkCommon)
@is_destroy = true #根据ID删除页面对应的数据js刷新页面 @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据js刷新页面
format.js format.js
elsif @attachment.container.is_a?(StudentWork) elsif @attachment.container.is_a?(StudentWork)
@is_destroy = true #根据ID删除页面对应的数据js刷新页面 @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据js刷新页面
format.js format.js
elsif @attachment.container.is_a?(Message) elsif @attachment.container.is_a?(Message)
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) } format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
@ -226,7 +247,7 @@ class AttachmentsController < ApplicationController
end end
format.js format.js
end end
end end
def delete_homework def delete_homework
@ -491,4 +512,8 @@ private
format.js format.js
end end
end end
def has_login
render_403 unless User.current.logged?
end
end end

File diff suppressed because it is too large Load Diff

@ -6,6 +6,7 @@ class CoursesController < ApplicationController
helper :members helper :members
helper :words helper :words
helper :attachments helper :attachments
helper :activity_notifys
before_filter :auth_login1, :only => [:show, :feedback] before_filter :auth_login1, :only => [:show, :feedback]
menu_item :overview menu_item :overview
@ -93,6 +94,9 @@ class CoursesController < ApplicationController
def new_join def new_join
@course = Course.find(params[:object_id]) @course = Course.find(params[:object_id])
respond_to do |format|
format.js
end
end end
# 课程搜索 # 课程搜索
@ -339,8 +343,8 @@ class CoursesController < ApplicationController
def export_course_member_excel def export_course_member_excel
@all_members = student_homework_score(0,0,0,"desc") @all_members = student_homework_score(0,0,0,"desc")
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
# 如果是ie11 需要转码 # 如果是ie 需要转码
if(/rv\:11\.0/.match(request.env["HTTP_USER_AGENT"]) != nil) if(/trident/.match(request.env["HTTP_USER_AGENT"]) != nil)
filename= URI::encode(filename) filename= URI::encode(filename)
end end
respond_to do |format| respond_to do |format|
@ -835,7 +839,7 @@ class CoursesController < ApplicationController
sql_select = "" sql_select = ""
if groupid == 0 if groupid == 0
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(student_works.final_score) SELECT AVG(student_works.final_score)
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{@course.id} AND homework_commons.course_id = #{@course.id}
@ -847,7 +851,7 @@ class CoursesController < ApplicationController
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
else else
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(student_works.final_score) SELECT AVG(student_works.final_score)
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{@course.id} AND homework_commons.course_id = #{@course.id}

@ -1,6 +1,6 @@
class HomeworkCommonController < ApplicationController class HomeworkCommonController < ApplicationController
layout "base_courses" layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create] before_filter :find_course, :only => [:index,:new,:create,:next_step]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
@ -15,20 +15,37 @@ class HomeworkCommonController < ApplicationController
end end
def new def new
respond_to do |format|
format.html
end
end
#新建作业下一步
def next_step
@homework_type = params[:homework_common_type]
@homework = HomeworkCommon.new @homework = HomeworkCommon.new
@homework.safe_attributes = params[:homework_common] @homework.safe_attributes = params[:homework_common]
@homework.late_penalty = 0 @homework.late_penalty = 0
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.publish_time = Time.now.strftime('%Y-%m-%d') @homework.publish_time = Time.now.strftime('%Y-%m-%d')
#匿评作业相关属性 if @homework_type == "1"
@homework_detail_manual = HomeworkDetailManual.new #匿评作业相关属性
@homework_detail_manual.ta_proportion = 0.6 @homework_detail_manual = HomeworkDetailManual.new
@homework_detail_manual.absence_penalty = 0 @homework_detail_manual.ta_proportion = 0.6
@homework_detail_manual.evaluation_num = 3 @homework_detail_manual.absence_penalty = 0
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') @homework_detail_manual.evaluation_num = 3
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
@homework.homework_detail_manual = @homework_detail_manual @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.homework_detail_manual = @homework_detail_manual
elsif @homework_type == "2"
#编程作业相关属性
@homework_detail_programing = HomeworkDetailPrograming.new
@homework.homework_detail_programing = @homework_detail_programing
end
respond_to do |format| respond_to do |format|
format.html format.html
end end
@ -49,15 +66,31 @@ class HomeworkCommonController < ApplicationController
homework.save_attachments(params[:attachments]) homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework) render_attachment_warning_if_needed(homework)
#匿评作业相关属性 if homework.homework_type == 2
homework_detail_manual = HomeworkDetailManual.new homework_detail_programing = HomeworkDetailPrograming.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 homework_detail_programing.language = "C++"
homework_detail_manual.comment_status = 1 homework_detail_programing.standard_code = params[:standard_code]
homework_detail_manual.evaluation_start = params[:evaluation_start]
homework_detail_manual.evaluation_end = params[:evaluation_end] if params[:input] && params[:output]
homework_detail_manual.evaluation_num = params[:evaluation_num] params[:input].each do |k,v|
homework_detail_manual.absence_penalty = params[:absence_penalty] if params[:output][k]
homework.homework_detail_manual = homework_detail_manual
end
end
end
homework.homework_detail_programing = homework_detail_programing
else
#匿评作业相关属性
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = params[:evaluation_start]
homework_detail_manual.evaluation_end = params[:evaluation_end]
homework_detail_manual.evaluation_num = params[:evaluation_num]
homework_detail_manual.absence_penalty = params[:absence_penalty]
homework.homework_detail_manual = homework_detail_manual
end
if homework.save if homework.save
respond_to do |format| respond_to do |format|

@ -94,12 +94,12 @@ class MessagesController < ApplicationController
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end end
# 与我相关动态的记录add start # 与我相关动态的记录add start
if(@board.course_id>0) #项目的先不管 if(@board && @board.course) #项目的先不管
teachers = searchTeacherAndAssistant(@board.course); teachers = searchTeacherAndAssistant(@board.course)
for teacher in teachers for teacher in teachers
if(teacher.user_id != User.current.id) if(teacher.user_id != User.current.id)
notify = ActivityNotify.new() notify = ActivityNotify.new()
if(@board.course_id>0) if(@board.course)
notify.activity_container_id = @board.course_id notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course' notify.activity_container_type = 'Course'
else else
@ -178,7 +178,7 @@ class MessagesController < ApplicationController
end end
# 与我相关动态的记录add start # 与我相关动态的记录add start
if(@board.course_id>0) #项目的先不管 if(@board && @board.course) #项目的先不管
notifyto_arr = {} notifyto_arr = {}
notifyto_arr[@topic.author_id] = @topic.author_id notifyto_arr[@topic.author_id] = @topic.author_id
if( params[:parent_topic] != nil && params[:parent_topic] != '') if( params[:parent_topic] != nil && params[:parent_topic] != '')
@ -188,7 +188,7 @@ class MessagesController < ApplicationController
notifyto_arr.each do |k,user_id| notifyto_arr.each do |k,user_id|
if(user_id != User.current.id) if(user_id != User.current.id)
notify = ActivityNotify.new() notify = ActivityNotify.new()
if(@board.course_id>0) if(@board.course)
notify.activity_container_id = @board.course_id notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course' notify.activity_container_type = 'Course'
else else

@ -1,8 +1,8 @@
class PollController < ApplicationController class PollController < ApplicationController
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll] before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
before_filter :find_container, :only => [:new,:create, :index] before_filter :find_container, :only => [:new,:create, :index]
before_filter :is_member_of_course, :only => [:index,:show,:poll_result] before_filter :is_member_of_course, :only => [:index,:show,:poll_result]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll]
include PollHelper include PollHelper
def index def index
if @course if @course
@ -360,6 +360,17 @@ class PollController < ApplicationController
end end
end end
#导出问卷
def export_poll
poll_questions = @poll.poll_questions
respond_to do |format|
format.xls {
send_data(poll_to_xls(poll_questions), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@poll.polls_name}.xls")
}
end
end
private private
def find_poll_and_course def find_poll_and_course
@poll = Poll.find params[:id] @poll = Poll.find params[:id]
@ -438,4 +449,59 @@ class PollController < ApplicationController
end end
pu pu
end end
#将poll中题目转换为Excel
def poll_to_xls poll_questions
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "poll"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
count_row = 0
poll_questions.each do |poll_question|
if poll_question.question_type == 1 || poll_question.question_type == 2
sheet1.row(count_row).default_format = blue
sheet1[count_row,0]= l(:label_poll_question_num,:num => poll_question.question_number)
sheet1[count_row + 1,0] = l(:label_poll_subtotal)
sheet1[count_row + 2,0] = l(:label_poll_proportion)
poll_question.poll_answers.each_with_index do |poll_answer,i|
sheet1[count_row, i + 1] = poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
sheet1[count_row + 1, i + 1] = poll_answer.poll_votes.count
sheet1[count_row + 2, i + 1] = statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)).to_s + "%"
end
sheet1[count_row + 3,0] = l(:label_poll_valid_commit)
sheet1[count_row + 3,1] = total_answer(poll_question.id)
count_row += 5
else
sheet1.row(count_row).default_format = blue
sheet1[count_row,0] = l(:label_poll_question_num,:num => poll_question.question_number)
sheet1[count_row,1] = poll_question.question_title
count_row += 1
poll_question.poll_votes.each do |poll_vote|
sheet1[count_row,0] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
count_row += 1
end
count_row += 1
end
end
sheet1.row(count_row).default_format = blue
sheet1[count_row ,0] = l(:label_bidding_user_studentname)
poll_questions.each_with_index do |poll_question, i|
sheet1[count_row ,i + 1] = poll_question.question_title
end
count_row += 1
@poll.users.each do |user|
sheet1[count_row ,0] = user.show_name
poll_questions.each_with_index do |poll_question, i|
if poll_question.question_type == 1 || poll_question.question_type == 2
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ") if poll_vote.poll_answer}.join(";")
else
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")}.join(";")
end
end
count_row += 1
end
book.write xls_report
xls_report.string
end
end end

@ -365,6 +365,21 @@ class ProjectsController < ApplicationController
def invite_members_by_mail def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin? if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all @inviter_lists = InviteList.where(project_id:@project.id).all
@inviters = []
@waiters = []
unless @inviter_lists.blank?
@inviter_lists.each do|inviter_list|
unless inviter_list.user.nil?
if inviter_list.user.member_of?(@project)
@inviters << inviter_list.user
@inviters_count = @inviters.size
else
@waiters << inviter_list.user
@waiters_count = @waiters.size
end
end
end
end
@is_zhuce = false @is_zhuce = false
respond_to do |format| respond_to do |format|
format.html format.html

@ -24,7 +24,7 @@ class TestController < ApplicationController
end end
@paths = homeworks_attach_path @paths = homeworks_attach_path
zipfile = ziping homeworks_attach_path zipfile = ziping homeworks_attach_path
send_file zipfile, :filename => bid.name, send_file zipfile, :filename => filename_for_content_disposition(bid.name),
:type => detect_content_type(zipfile) :type => detect_content_type(zipfile)
rescue Errno::ENOENT => e rescue Errno::ENOENT => e
logger.error "[Errno::ENOENT] ===> #{e}" logger.error "[Errno::ENOENT] ===> #{e}"

@ -25,7 +25,7 @@ class UsersController < ApplicationController
menu_item :user_course, :only => :user_courses menu_item :user_course, :only => :user_courses
menu_item :user_homework, :only => :user_homeworks menu_item :user_homework, :only => :user_homeworks
menu_item :user_project, :only => [:user_projects, :watch_projects] menu_item :user_project, :only => [:user_projects, :watch_projects]
menu_item :requirement_focus, :only => :watch_bids # menu_item :requirement_focus, :only => :watch_bids
menu_item :requirement_focus, :only => :watch_contests menu_item :requirement_focus, :only => :watch_contests
menu_item :user_newfeedback, :only => :user_newfeedback menu_item :user_newfeedback, :only => :user_newfeedback
@ -36,14 +36,14 @@ class UsersController < ApplicationController
# #
before_filter :can_show_course, :only => [:user_courses,:user_homeworks] before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index] :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index]
#edit has been deleted by huang, 2013-9-23 #edit has been deleted by huang, 2013-9-23
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
before_filter :auth_user_extension, only: :show before_filter :auth_user_extension, only: :show
@ -141,25 +141,25 @@ class UsersController < ApplicationController
##added by fq ##added by fq
def watch_bids def watch_bids
cond = 'bids.reward_type <> 1' # cond = 'bids.reward_type <> 1'
@bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang # @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
@offset, @limit = api_offset_and_limit({:limit => 10}) # @offset, @limit = api_offset_and_limit({:limit => 10})
@bid_count = @bids.count # @bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page'] # @bid_pages = Paginator.new @bid_count, @limit, params['page']
@offset ||= @bid_pages.reverse_offset # @offset ||= @bid_pages.reverse_offset
unless @offset == 0 # unless @offset == 0
@bid = @bids.offset(@offset).limit(@limit).all.reverse # @bid = @bids.offset(@offset).limit(@limit).all.reverse
else # else
limit = @bid_count % @limit # limit = @bid_count % @limit
@bid = @bids.offset(@offset).limit(limit).all.reverse # @bid = @bids.offset(@offset).limit(limit).all.reverse
end # end
#
respond_to do |format| # respond_to do |format|
format.html { # format.html {
render :layout => 'base_users' # render :layout => 'base_users'
} # }
format.api # format.api
end # end
end end
#new add by linchun #new add by linchun
@ -215,24 +215,24 @@ class UsersController < ApplicationController
# added by huang # added by huang
def user_homeworks def user_homeworks
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) # @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
@memberships = [] # @memberships = []
@membership.each do |membership| # @membership.each do |membership|
if membership.project.project_type == 1 # if membership.project.project_type == 1
@memberships << membership # @memberships << membership
end # end
end # end
@bid = [] # @bid = []
@memberships.each do |membership| # @memberships.each do |membership|
@bid += membership.project.homeworks # @bid += membership.project.homeworks
end # end
@bid = @bid.group_by {|bid| bid.courses.first.id} # @bid = @bid.group_by {|bid| bid.courses.first.id}
unless User.current.admin? # unless User.current.admin?
if !@user.active? # if !@user.active?
render_404 # render_404
return # return
end # end
end # end
end end
@ -757,7 +757,7 @@ class UsersController < ApplicationController
when '3' then when '3' then
@obj = Issue.find_by_id(@obj_id) @obj = Issue.find_by_id(@obj_id)
when '4' then when '4' then
@obj = Bid.find_by_id(@obj_id) # @obj = Bid.find_by_id(@obj_id)
when '5' then when '5' then
@obj = Forum.find_by_id(@obj_id) @obj = Forum.find_by_id(@obj_id)
when '6' when '6'
@ -800,7 +800,7 @@ class UsersController < ApplicationController
when '3' then when '3' then
@obj = Issue.find_by_id(@obj_id) @obj = Issue.find_by_id(@obj_id)
when '4' then when '4' then
@obj = Bid.find_by_id(@obj_id) # @obj = Bid.find_by_id(@obj_id)
when '5' then when '5' then
@obj = Forum.find_by_id(@obj_id) @obj = Forum.find_by_id(@obj_id)
when '6' when '6'

@ -11,7 +11,7 @@ class ZipdownController < ApplicationController
def download def download
if User.current.logged? if User.current.logged?
begin begin
send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => params[:filename], :type => detect_content_type(params[:file]) send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file])
rescue => e rescue => e
render file: 'public/no_file_found.html' render file: 'public/no_file_found.html'
end end
@ -30,8 +30,7 @@ class ZipdownController < ApplicationController
if file_count > 0 if file_count > 0
zipfile = zip_bid bid zipfile = zip_bid bid
else else
render file: 'public/no_file_found.html' zipfile = {:message => "no file"}
return
end end
elsif params[:obj_class] == "HomeworkCommon" elsif params[:obj_class] == "HomeworkCommon"
homework = HomeworkCommon.find params[:obj_id] homework = HomeworkCommon.find params[:obj_id]
@ -41,8 +40,7 @@ class ZipdownController < ApplicationController
if file_count > 0 if file_count > 0
zipfile = zip_homework_common homework zipfile = zip_homework_common homework
else else
render file: 'public/no_file_found.html' zipfile = {:message => "no file"}
return
end end
else else
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!" logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
@ -61,9 +59,10 @@ class ZipdownController < ApplicationController
if homework != nil if homework != nil
unless homework.attachments.empty? unless homework.attachments.empty?
zipfile = zip_homework_by_user homework zipfile = zip_homework_by_user homework
send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) + filename = ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) +
"_" + (homework.user.lastname.nil? ? "" : homework.user.lastname) + (homework.user.firstname.nil? ? "" : homework.user.firstname) + "_" + homework.user.show_name +
"_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile) "_" + homework.name + ".zip"
send_file zipfile.file_path, :filename => filename_for_content_disposition(filename), :type => detect_content_type(zipfile.file_path) if(zipfile)
else else
render file: 'public/no_file_found.html' render file: 'public/no_file_found.html'
end end
@ -150,7 +149,7 @@ class ZipdownController < ApplicationController
end end
end end
out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){ out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){
zipping("#{homework_attach.user.lastname}#{homework_attach.user.firstname}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", zipping("#{homework_attach.user.show_name}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
} }
end end
@ -170,7 +169,7 @@ class ZipdownController < ApplicationController
end end
end end
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){ out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{work.user.lastname}#{work.user.firstname}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", zipping("#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
} }
end end

@ -0,0 +1,6 @@
module ActivityNotifysHelper
def get_new_notify_count(container,type)
query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=? and is_read=0',container.id,type,User.current.id);
return query.count()
end
end

@ -72,8 +72,8 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location before_save :files_to_final_location
after_create :office_conver, :be_user_score ,:act_as_forge_activity# user_score after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score
after_update :be_user_score after_update :office_conver, :be_user_score
after_destroy :delete_from_disk,:down_user_score after_destroy :delete_from_disk,:down_user_score
# add by nwb # add by nwb
@ -259,12 +259,14 @@ class Attachment < ActiveRecord::Base
end end
def office_conver def office_conver
saved_path = File.join(Rails.root, "files", "convered_office") # 不在这里做后台转换,换为点击时做转换
unless Dir.exist?(saved_path) # return unless %w(Project Course).include? (self.container_type)
Dir.mkdir(saved_path) # saved_path = File.join(Rails.root, "files", "convered_office")
end # unless Dir.exist?(saved_path)
convered_file = File.join(saved_path, self.disk_filename + ".html") # Dir.mkdir(saved_path)
OfficeConverTask.new.conver(self.diskfile, convered_file) # end
# convered_file = File.join(saved_path, self.disk_filename + ".pdf")
# OfficeConverTask.new.conver(self.diskfile, convered_file)
end end
# Copies the temporary file to its final location # Copies the temporary file to its final location

@ -10,158 +10,158 @@ homework_type == 1 文件提交
homework_type == 2 Project homework_type == 2 Project
=end =end
class Bid < ActiveRecord::Base class Bid < ActiveRecord::Base
Enterprise = 1 # Enterprise = 1
Contest = 2 # Contest = 2
Homework = 3 # Homework = 3
HomeworkFile = 1 # HomeworkFile = 1
HomeworkProject = 2 # HomeworkProject = 2
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password # attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
include Redmine::SafeAttributes # include Redmine::SafeAttributes
include ApplicationHelper # include ApplicationHelper
has_many_kindeditor_assets :assets, :dependent => :destroy # has_many_kindeditor_assets :assets, :dependent => :destroy
belongs_to :author, :class_name => 'User', :foreign_key => :author_id # belongs_to :author, :class_name => 'User', :foreign_key => :author_id
belongs_to :course # belongs_to :course
has_many :biding_projects, :dependent => :destroy # has_many :biding_projects, :dependent => :destroy
has_many :projects, :through => :biding_projects # has_many :projects, :through => :biding_projects
has_many :courses_member, :class_name => 'User', :through => :courses # has_many :courses_member, :class_name => 'User', :through => :courses
has_many :journals_for_messages, :as => :jour, :dependent => :destroy # has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
has_many :homework_for_courses, :dependent => :destroy # has_many :homework_for_courses, :dependent => :destroy
has_many :courses, :through => :homework_for_courses, :source => :course # has_many :courses, :through => :homework_for_courses, :source => :course
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy # has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
has_many :homework_evaluations, :through => :homeworks # has_many :homework_evaluations, :through => :homeworks
has_many :join_in_contests, :dependent => :destroy # has_many :join_in_contests, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy # has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}" # # has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
acts_as_attachable # acts_as_attachable
#
NAME_LENGTH_LIMIT = 60 # NAME_LENGTH_LIMIT = 60
DESCRIPTION_LENGTH_LIMIT = 3000 # DESCRIPTION_LENGTH_LIMIT = 3000
validates :name, length: {maximum: NAME_LENGTH_LIMIT}, presence: true # validates :name, length: {maximum: NAME_LENGTH_LIMIT}, presence: true
validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT} # validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT}
validates :author_id, presence: true # validates :author_id, presence: true
validates :deadline, presence: true, format: {:with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/} # validates :deadline, presence: true, format: {:with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/}
validates :name, length: {maximum: NAME_LENGTH_LIMIT} # validates :name, length: {maximum: NAME_LENGTH_LIMIT}
validates :budget, format: { with: ->(p) { if p.reward_type == 1 then /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/ # validates :budget, format: { with: ->(p) { if p.reward_type == 1 then /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
elsif p.reward_type == 3 then /^(\d+)$|^(\d+).([0-9]{1})$/ end } } # elsif p.reward_type == 3 then /^(\d+)$|^(\d+).([0-9]{1})$/ end } }
#
validate :validate_user # validate :validate_user
validate :validate_reward_type # validate :validate_reward_type
after_create :act_as_activity # after_create :act_as_activity
after_destroy :delete_kindeditor_assets # after_destroy :delete_kindeditor_assets
scope :visible, lambda {|*args| # scope :visible, lambda {|*args|
nil # nil
} # }
#
scope :like, lambda {|arg| # scope :like, lambda {|arg|
if arg.blank? # if arg.blank?
where(nil) # where(nil)
else # else
pattern = "%#{arg.to_s.strip.downcase}%" # pattern = "%#{arg.to_s.strip.downcase}%"
where("LOWER(id) LIKE :p OR LOWER(name) LIKE :p OR LOWER(description) LIKE :p", :p => pattern) # where("LOWER(id) LIKE :p OR LOWER(name) LIKE :p OR LOWER(description) LIKE :p", :p => pattern)
end # end
} # }
#
scope :course_visible, lambda {|*args| # scope :course_visible, lambda {|*args|
includes(:courses).where(Course.allowed_to_condition(args.shift || User.current, :view_homeworks, *args)) # includes(:courses).where(Course.allowed_to_condition(args.shift || User.current, :view_homeworks, *args))
} # }
#
acts_as_watchable # acts_as_watchable
acts_as_taggable # acts_as_taggable
#
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" }, # acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
:description => :description, # :description => :description,
:author => :author, # :author => :author,
:url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}} # :url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}}
#
acts_as_activity_provider :type => 'homeworks', # acts_as_activity_provider :type => 'homeworks',
:author_key => :author_id # :author_key => :author_id
#
acts_as_activity_provider :find_options => {:include => [:projects, :author]}, # acts_as_activity_provider :find_options => {:include => [:projects, :author]},
:author_key => :author_id # :author_key => :author_id
#
safe_attributes 'name',
'description',
'budget',
'deadline',
'homework_type',
'reward_type',
'password'
# safe_attributes 'name', # safe_attributes 'name',
# 'description', # 'description',
# 'deadline' # 'budget',
def add_jour(user, notes, reference_user_id = 0, options = {}) # 'deadline',
if options.count == 0 # 'homework_type',
jfm = JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id) # 'reward_type',
self.journals_for_messages << jfm # 'password'
jfm #
else #
jfm = self.journals_for_messages.build(options) # # safe_attributes 'name',
jfm.save # # 'description',
jfm # # 'deadline'
end # def add_jour(user, notes, reference_user_id = 0, options = {})
end # if options.count == 0
# jfm = JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
def self.creat_bids(budget, deadline, name, description=nil, reward_type) # self.journals_for_messages << jfm
self.create(:author_id => User.current.id, :budget => budget, # jfm
:deadline => deadline, :name => name, :description => description, :commit => 0, :reward_type => reward_type) # else
# self.acts << Activity.new(:user_id => self.author_id) # jfm = self.journals_for_messages.build(options)
end # jfm.save
# jfm
def update_bids(budget, deadline, name, description=nil) # end
if(User.current.id == self.author_id) # end
self.name = name #
self.budget = budget # def self.creat_bids(budget, deadline, name, description=nil, reward_type)
self.deadline = deadline # self.create(:author_id => User.current.id, :budget => budget,
self.description = description # :deadline => deadline, :name => name, :description => description, :commit => 0, :reward_type => reward_type)
self.save # # self.acts << Activity.new(:user_id => self.author_id)
end # end
end #
# def update_bids(budget, deadline, name, description=nil)
def delete_bids # if(User.current.id == self.author_id)
unless self.nil? # self.name = name
if User.current.id == self.author_id # self.budget = budget
self.destroy # self.deadline = deadline
end # self.description = description
end # self.save
end # end
# end
def set_commit(commit) #
self.update_attribute(:commit, commit) # def delete_bids
end # unless self.nil?
# if User.current.id == self.author_id
private # self.destroy
# end
def validate_user # end
errors.add :author_id, :invalid if author.nil? || !author.active? # end
end #
# def set_commit(commit)
def validate_reward_type # self.update_attribute(:commit, commit)
errors.add :reward_type, :invalid if self.reward_type == 0 # end
end #
# private
def act_as_activity #
self.acts << Activity.new(:user_id => self.author_id) # def validate_user
end # errors.add :author_id, :invalid if author.nil? || !author.active?
# end
# used to validate weather the user is the creater of the bid #
# added by william # def validate_reward_type
def validate_bid_manager(user_id) # errors.add :reward_type, :invalid if self.reward_type == 0
unless user_id.nil? # end
if self.author_id == user_id #
return true # def act_as_activity
else # self.acts << Activity.new(:user_id => self.author_id)
return false # end
end #
end # # used to validate weather the user is the creater of the bid
end # # added by william
# def validate_bid_manager(user_id)
# Time 2015-04-01 14:19:06 # unless user_id.nil?
# Author lizanle # if self.author_id == user_id
# Description 删除对应课程通知的图片资源 # return true
def delete_kindeditor_assets # else
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::BID # return false
end # end
# end
# end
#
# # Time 2015-04-01 14:19:06
# # Author lizanle
# # Description 删除对应课程通知的图片资源
# def delete_kindeditor_assets
# delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::BID
# end
end end

@ -103,7 +103,7 @@ class Mailer < ActionMailer::Base
course_ids = courses.map {|course| course.id}.join(",") course_ids = courses.map {|course| course.id}.join(",")
# 查询user的缺陷项目中成员都能收到 # 查询user的缺陷项目中成员都能收到
sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
@issues = Issue.find_by_sql(sql) @issues = Issue.find_by_sql(sql)
@ -115,30 +115,45 @@ class Mailer < ActionMailer::Base
count = courses.count count = courses.count
count = count - 1 count = count - 1
for i in 0..count do for i in 0..count do
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc") bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC') attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
@bids += bids if bids.count > 0 @bids += bids if bids.count > 0
@attachments += attachments if attachments.count > 0 @attachments += attachments if attachments.count > 0
end end
end end
# user 提交的作业 # user 提交的作业
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子 # 查询user所在项目添加wiki
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where @wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0
and (wc.updated_on between '#{date_from}' and '#{date_to}') order by updated_on desc")
# 查询user在课程中发布的讨论帖子
course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
b.id = me.board_id and b.course_id = m.course_id
and b.course_id is not Null and m.user_id = '#{user.id}'
and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
# 查询user在项目中发布的讨论帖子
project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
b.id = me.board_id and b.project_id = m.project_id
and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
# messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@course_messages ||= [] @course_messages ||= []
@project_messages ||= [] @project_messages ||= []
unless messages.first.nil? unless course_mesages.first.nil?
messages.each do |msg| course_mesages.each do |msg|
if msg.project @course_messages << msg
@project_messages << msg
elsif msg.course
@course_messages << msg
end
end end
end end
unless project_messages.first.nil?
project_messages.each do |msg|
@project_messages << msg
end
end
# wiki
# 查询user在课程中发布的通知项目中发的新闻 # 查询user在课程中发布的通知项目中发的新闻
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
@ -148,17 +163,24 @@ class Mailer < ActionMailer::Base
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
# 查询user在课程及个人中留言 # 查询user在课程及个人中留言
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c
jour_type='Course' and user_id = #{user.id} where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
@user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
# 查询user在项目中留言用户反馈
@project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p
where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id
and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
# 查询user新建贴吧或发布帖子 # 查询user新建贴吧或发布帖子
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news, has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} @course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发 #有内容才发,没有不发
mail :to => user.mail,:subject => subject if has_content mail :to => user.mail,:subject => subject if has_content
@ -198,8 +220,8 @@ class Mailer < ActionMailer::Base
@title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}" @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
@issue_author_url = url_for(user_activities_url(@user)) @issue_author_url = url_for(user_activities_url(@user))
@url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型 @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
when :Bid # when :Bid
course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
when :Project when :Project
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
@ -235,12 +257,12 @@ class Mailer < ActionMailer::Base
mail :to => @recipients, mail :to => @recipients,
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ", :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
:filter => true :filter => true
elsif journals_for_message.jour.class.to_s.to_sym == :Bid # elsif journals_for_message.jour.class.to_s.to_sym == :Bid
if !journals_for_message.jour.author.notify_about? journals_for_message # if !journals_for_message.jour.author.notify_about? journals_for_message
return -1 # return -1
end # end
#
mail :to => recipients, :subject => @title,:filter => true # mail :to => recipients, :subject => @title,:filter => true
elsif journals_for_message.jour.class.to_s.to_sym == :Contest elsif journals_for_message.jour.class.to_s.to_sym == :Contest
if !journals_for_message.jour.author.notify_about? journals_for_message if !journals_for_message.jour.author.notify_about? journals_for_message
return -1 return -1

@ -116,21 +116,23 @@ class Member < ActiveRecord::Base
# 查找每个学生每个作业的评分 # 查找每个学生每个作业的评分
def student_homework_score def student_homework_score
score_count = 0
homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{self.course_id} AND homework_commons.course_id = #{self.course_id}
AND student_works.user_id = #{self.user_id}") AND student_works.user_id = #{self.user_id}")
homework_score.each do |homework| score_count = StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
mem_score = 0
if homework[:score]
mem_score = homework[:score]
end
score_count = score_count + mem_score
end
[homework_score, format("%0.2f", score_count)] [homework_score, format("%0.2f", score_count)]
end end
def student_work_score
StudentWork.select("homework_commons.name, student_works.final_score").joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}")
end
def student_work_score_avg
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
end
protected protected
def validate_role def validate_role

@ -277,15 +277,18 @@ class User < Principal
end end
def show_name def show_name
name = ""
unless self.user_extensions.nil? unless self.user_extensions.nil?
if self.user_extensions.identity == 2 if self.user_extensions.identity == 2
firstname name = firstname
else else
lastname+firstname name = lastname+firstname
end end
else else
lastname+firstname name = lastname+firstname
end end
name = name.empty? || name.nil? ? login : name
name
end end
## end ## end

@ -330,7 +330,7 @@ class CoursesService
def homework_list params,current_user def homework_list params,current_user
course = Course.find(params[:id]) course = Course.find(params[:id])
if course.is_public != 0 || current_user.member_of_course?(course) if course.is_public != 0 || current_user.member_of_course?(course)
bids = course.homeworks.order('deadline DESC') bids = course.homework_commons.order('end_time DESC')
bids = bids.like(params[:name]) if params[:name].present? bids = bids.like(params[:name]) if params[:name].present?
homeworks = [] homeworks = []
bids.each do |bid| bids.each do |bid|
@ -375,9 +375,9 @@ class CoursesService
unless latest_attachment.nil? unless latest_attachment.nil?
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message =>latest_attachment.author.realname<< l(:label_recently_updated_courseware,:locale => get_user_language(current_user))<<""<<latest_attachment.filename} latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message =>latest_attachment.author.realname<< l(:label_recently_updated_courseware,:locale => get_user_language(current_user))<<""<<latest_attachment.filename}
end end
latest_bid = course.homeworks.order('updated_on DESC').first latest_bid = course.homework_commons.order('updated_at DESC').first
unless latest_bid.nil? unless latest_bid.nil?
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => latest_bid.author.realname<<l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<""<<latest_bid.name} latest_course_dynamics << {:type => 4,:time => latest_bid.updated_at,:message => latest_bid.user.realname<<l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<""<<latest_bid.name}
end end
# Time 2015-04-07 14:58:30 # Time 2015-04-07 14:58:30
@ -390,24 +390,24 @@ class CoursesService
#每个作业中的最新留言 #每个作业中的最新留言
messages = [] # messages = []
course.homeworks.each do |bid| # course.homework_commons.each do |hc|
jour = bid.journals_for_messages.order("created_on desc").first # jour = hc.journals_for_messages.order("created_on desc").first
unless jour.nil? # unless jour.nil?
messages << jour # messages << jour
end # end
end # end
unless messages.count == 0 # unless messages.count == 0
messages.sort!{|order,newer| newer.created_on <=> order.created_on} # messages.sort!{|order,newer| newer.created_on <=> order.created_on}
end # end
latest_bid_message = messages.first # latest_bid_message = messages.first
unless latest_bid_message.nil? # unless latest_bid_message.nil?
latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))} # latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))}
end # end
#每个作业中学生最后提交的作业 #每个作业中学生最后提交的作业
homeworks = [] homeworks = []
course.homeworks.each do |bid| course.homework_commons.each do |bid|
homework_attach = bid.homeworks.order('updated_at DESC').first homework_attach = bid.student_works.order('updated_at DESC').first
unless homework_attach.nil? unless homework_attach.nil?
homeworks << homework_attach homeworks << homework_attach
end end
@ -533,21 +533,21 @@ class CoursesService
mems mems
end end
def show_homework_info course,bid,current_user,is_course_teacher def show_homework_info course,bid,current_user,is_course_teacher
author_real_name = bid.author.lastname + bid.author.firstname author_real_name = bid.user.lastname + bid.user.firstname
many_times = course.homeworks.index(bid) + 1 many_times = course.homework_commons.index(bid) + 1
name = bid.name name = bid.name
homework_count = bid.homeworks.count #已提交的作业数量 homework_count = bid.student_works.count #已提交的作业数量
student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count #student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
description = bid.description description = bid.description
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2 #if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
state = bid.comment_status state = bid.homework_detail_manual.comment_status
unless is_course_teacher unless is_course_teacher
homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
end end
#end #end
open_anonymous_evaluation = bid.open_anonymous_evaluation open_anonymous_evaluation = bid.homework_detail_manual.comment_status
{:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.author,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count, {:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.user,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0,
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_on,:deadline => bid.deadline} :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_at,:deadline => bid.end_time}
end end

@ -14,21 +14,21 @@ class HomeworkService
# state=1 关闭匿评 # state=1 关闭匿评
# state=2 匿评结束 # state=2 匿评结束
def show_homework params def show_homework params
@bid = Bid.find(params[:id]) @bid = HomeworkCommon.find(params[:id])
course = @bid.courses.first course = @bid.course
author = @bid.author.lastname + @bid.author.firstname author = @bid.user.lastname + @bid.user.firstname
many_times = course.homeworks.index(@bid) + 1 many_times = course.homework_commons.index(@bid) + 1
name = @bid.name name = @bid.name
homework_count = @bid.homeworks.count #已提交的作业数量 homework_count = @bid.student_works.count #已提交的作业数量
student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count #student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
description = @bid.description description = @bid.description
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2 #if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
state = @bid.comment_status state = @bid.homework_detail_manual.comment_status
#end #end
open_anonymous_evaluation = @bid.open_anonymous_evaluation open_anonymous_evaluation = @bid.homework_type
jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') #jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
{:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.author,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count, {:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.user,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0,
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_on,:deadline => @bid.deadline,:jours => jours} :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_at,:deadline => @bid.end_time,:jours => nil}
end end
# 启动作业匿评前提示信息 # 启动作业匿评前提示信息

@ -255,7 +255,9 @@ class UsersService
watcher.push(params[:user_id]) watcher.push(params[:user_id])
scope = scope.where("id not in (?)",watcher) scope = scope.where("id not in (?)",watcher)
end end
scope = scope.like(params[:name],search_by) #scope = scope.like(params[:name],search_by)
scope = scope.where("( LOWER(login) LIKE ? or LOWER(concat(lastname, firstname)) LIKE ? or LOWER(mail) LIKE ? )",
"%#{params[:name]}%","%#{params[:name]}%","%#{params[:name]}%")
end end
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
else else

@ -1,9 +1,11 @@
// @status: 0 该项目不存在1 不重复加入2 成功加入; 3 已是项目成员;其它 加入失败
<% if @status == 0%> <% if @status == 0%>
alert("<%= l('project.join.tips.notexist') %>"); alert("<%= l('project.join.tips.notexist') %>");
<% elsif @status == 1%> <% elsif @status == 1%>
alert("<%= l('project.join.tips.repeat') %>"); alert("<%= l('project.join.tips.repeat') %>");
<% elsif @status == 2%> <% elsif @status == 2%>
alert("<%= l('project.join.tips.success') %>"); alert("<%= l('project.join.tips.success') %>");
hideModal($("#popbox"));
<% elsif @status == 3%> <% elsif @status == 3%>
alert("<%= l('project.join.tips.has') %>"); alert("<%= l('project.join.tips.has') %>");
<%else%> <%else%>

@ -53,7 +53,7 @@
<% end %> <% end %>
<% if options[:author] %> <% if options[:author] %>
<span class="author" title="<%= attachment.author%>"> <span class="author" title="<%= attachment.author%>">
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>, <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "author_name" %>,
<%= format_time(attachment.created_on) %> <%= format_time(attachment.created_on) %>
</span> </span>
<% end %> <% end %>

@ -1,11 +1,13 @@
<style type="text/css">
input.is_public,input.is_public_checkbox{height:12px;}
input.is_public_checkbox{margin-left:4px;margin-right:4px;}
</style>
<div class="fl"> <div class="fl">
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html"> <span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %> <% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %> <% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment"> <span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %> <%= text_field_tag("attachments[p#{i}][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>
<%= 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') %> <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
<%= if attachment.id.nil? <%= if attachment.id.nil?
#待补充代码 #待补充代码

@ -29,7 +29,7 @@
<% is_float ||= false %> <% is_float ||= false %>
<% for attachment in attachments %> <% for attachment in attachments %>
<div style="float:left;"> <div style="float:left;">
<p style="height:14px;line-height:10px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <p style="height:14px;line-height:12px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%if is_float%> <%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;"> <div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%> <% end%>

@ -1,25 +0,0 @@
<!-- fq --> <!-- modified by bai -->
<%= error_messages_for 'bid' %>
<!--[form:project]-->
<p><%= l(:label_fork_form_new_description) %></p>
<!-- modified by bai -->
<p style="margin-left:-68px;padding-right: 20px;"><strong><%= l(:label_choose_course) %><span class="required"> *&nbsp;</span></strong><%= select_tag 'course', course_options_for_select(@courses) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :value => @bid.name %></p>
<!-- end -->
<p style="margin-left:-10px;padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
<!-- <p><%#= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
:onChange => "show('bid_reward_type', 'bid_budget', '"+l(:label_bids_reward_what)+"','"+l(:label_bids_new_money)+"','"+l(:label_bids_new_credit)+"','"+l(:label_bids_new_content)+"')" %>
<%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> -->
<p><%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" , :readonly => true %><%= calendar_for('bid_deadline')%>
<!--
<p><%#= f.select :homework_type, homework_type_option %>
</p>
-->
<p><%= f.select :is_evaluation, is_evaluation_option %>
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @homework} %></p>
</fieldset>

@ -1,36 +0,0 @@
<!-- huang -->
<script type="text/javascript" language="javascript">
function show(id, id_t, label_reward, label_money, label_credit, label_content) {
var text = $('#' + id);
var text_t = $('#' + id_t);
if (text.val() == 0) {
text_t.attr("placeholder", label_reward);
}
if (text.val() == 1) {
text_t.attr("placeholder", label_money);
}
if (text.val() == 3) {
text_t.attr("placeholder", label_credit);
}
if (text.val() == 2) {
text_t.attr("placeholder", label_content);
}
return content;
}
</script>
<%= error_messages_for 'bid' %>
<!--[form:project]-->
<p style="width:500px;"><%= l(:label_bids_form_contest_new_description) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %></p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></p>
<p style="margin-left:-10px;"><%= f.text_field :password, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
<p>
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
<!-- 设置奖项设置的打开 关闭开关-->
</p>
<!-- <em class="info" style="margin-left:95px;"><%= l(:text_contest_reward) %></em> -->
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%></p>

@ -1,30 +0,0 @@
<div class="inf_user_image">
<% for user in @bid.watcher_users %>
<ul class="list_watch"><li>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(user), :class => "avatar") %></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description">
<% unless user.memberships.empty? %>
<%= l(:label_x_contribute_to, :count => user.memberships.count) %>
<% for member in user.memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
</p></td>
</tr>
<tr>
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>
</tr>
</table></td>
</tr>
</table></li></ul>
<% end %>
</div>

@ -253,7 +253,7 @@
}; };
params.get_ref_str_call=function(btn){ params.get_ref_str_call=function(btn){
var div = btn.parent('div'); var div = btn.parent('div');
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'</blockquote>'; var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'<div class="cl"></div></blockquote>';
return str; return str;
} }
nh_init_board(params); nh_init_board(params);

@ -47,6 +47,7 @@
</li> </li>
<li> <li>
<div nhname="quote_show" id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div> <div nhname="quote_show" id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<div class="cl"></div>
<% unless replying %> <% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label> <label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %> <% end %>

@ -238,7 +238,7 @@
}; };
params.get_ref_str_call=function(btn){ params.get_ref_str_call=function(btn){
var div = btn.parent('div'); var div = btn.parent('div');
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'</blockquote>'; var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'<div class="cl"></div></blockquote>';
return str; return str;
} }
nh_init_board(params); nh_init_board(params);

@ -1,11 +1,11 @@
<style type="text/css"> <style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;} /*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;} span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )} span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;} div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;} span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;} div.ke-toolbar .ke-outline{border:none;}*/
.break_word {width:100%;} .break_word {width:100%;}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -33,7 +33,8 @@
else if (window.attachEvent) else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus) window.attachEvent("onload", buildsubmenus)
</script> </script>
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<% if @project %> <% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %> <%= render :partial => 'project_show', locals: {project: @project} %>
@ -104,6 +105,7 @@ function nh_check_field(params){
} }
if(params.content.html()!=params.textarea.html() || params.issubmit==true){ if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html()); params.textarea.html(params.content.html());
params.content.sync(); //用上面那句ie11提交到服务器居然木有值
if(params.content.isEmpty()){ if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空'); params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'}); params.contentmsg.css({color:'#ff0000'});
@ -123,21 +125,20 @@ function nh_init_board(params){
if(params.textarea.data('init') == undefined){ if(params.textarea.data('init') == undefined){
//初始化编辑器 //初始化编辑器
var editor = params.kindutil.create(params.textarea, { var editor = params.kindutil.create(params.textarea, {
resizeType : 1, // allowPreviewEmoticons : false,
allowPreviewEmoticons : false, // allowImageUpload : false,
allowImageUpload : false, resizeType : 1,minWidth:"1px",width:"565px",height:"150px",
minWidth:"1px", allowFileManager:true,uploadJson:"/kindeditor/upload",
width:"565px", fileManagerJson:"/kindeditor/filemanager",
items : ['emoticons'],
afterChange:function(){//按键事件 afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
}, },
afterCreate:function(){ afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.about_talk); // var toolbar = $("div[class='ke-toolbar']",params.about_talk);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); // $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar); // params.toolbar_container.append(toolbar);
} }
}); }).loadPlugin('paste');
//主题输入框按键事件 //主题输入框按键事件
params.inputsubject.keyup(function(){ params.inputsubject.keyup(function(){
@ -184,9 +185,17 @@ function nh_init_board(params){
if(params.quote_input!=undefined)params.quote_input.empty(); if(params.quote_input!=undefined)params.quote_input.empty();
}else{ }else{
if(params.type=='reply'){ if(params.type=='reply'){
params.jumphref.attr('href','#'+params.form.attr('id')); params.textarea.show();
params.jumphref[0].click(); params.textarea.focus();
}else params.inputsubject.focus(); params.textarea.hide();
//params.jumphref.attr('href','#'+params.form.attr('id'));
//params.jumphref[0].click();
}else{
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// params.inputsubject.focus();
}
} }
}); });
params.textarea.data('init','1');//标记为已经初始化 params.textarea.data('init','1');//标记为已经初始化

@ -1,31 +1,210 @@
<style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<div class="msg_box" id='leave-message'> <div class="msg_box fl" id='leave-message' nhname="new_message">
<%# reply_allow = JournalsForMessage.create_by_user? User.current %> <%# reply_allow = JournalsForMessage.create_by_user? User.current %>
<h4><%= l(:label_leave_message) %></h4> <h4><%= l(:label_leave_message) %></h4>
<% if !User.current.logged?%> <% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;"> <div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_tips) %> <%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %> <%= link_to l(:label_user_login_new), signin_path %>
<hr/> <hr/>
</div> </div>
<% else %> <% else %>
<%= form_for('new_form', :method => :post, <%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%> :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;", <%#= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%> :placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%>
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10" onclick="KindEditor.instances[0].html('');">取&nbsp;&nbsp;消</a> <textarea cols="40" nhname="new_message_textarea" maxlength="250" name="new_form[course_message]" placeholder="请在此留下你的意见和建议!" rows="20" style="display: none;"></textarea>
<a href="javascript:void(0)" onclick='leave_message_editor.sync();$("#leave_message_form").submit();' class="blue_btn fr mt10"> <p nhname="contentmsg"></p>
<%= l(:button_leave_meassge)%> <% end %>
</a> <div class="cl"></div>
<% end %> <div>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10" nhname="cancel_btn">取&nbsp;&nbsp;消</a>
<a href="javascript:void(0)" onclick='$("#leave_message_form").submit();' class="blue_btn fr mt10">
<%= l(:button_leave_meassge)%>
</a>
</div>
<% end %> <% end %>
</div> </div>
<div class="cl"></div>
<div id="history"> <div id="history">
<%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %> <%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div> </div>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul> </ul>
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
return editor;
}
function nh_check_field(params){
var result=true;
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function init_form(params){
// var flag = false;
// if(params.form.attr('data-remote') != undefined ){
// flag = true
// }
// params.form[0].onsubmit = function(){
// if(flag){
// $(this).removeAttr('data-remote');//不这么搞return false没用 花擦花擦
// }
// var is_checked = nh_check_field({
// issubmit:true,
// content:params.editor,
// contentmsg:params.contentmsg,
// textarea:params.textarea
// });
// if(is_checked){
// if(flag){
// alert('add')
// $(this).attr('data-remote','true');
// }
// alert('ok')
// return true;
// }
// return false;
// }
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
// return true; //这个涛哥的firefox不能提交
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
}
return false;
});
}
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
}
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// $("#nhjump").attr('href','#'+params.div_form.attr('id'));
// $("#nhjump")[0].click();
}
},300);
params.textarea.data('init',1);
});
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
$("a[nhname='cancel_btn']",params.div_form).click(function(){
nh_reset_form(params);
});
params.textarea.data('init',1);
}
});
});
});
</script>

@ -29,9 +29,9 @@
:class => "delete", :title => l(:button_delete)) %> :class => "delete", :title => l(:button_delete)) %>
<% end %> <% end %>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'', <%#= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

@ -32,7 +32,6 @@
<script type="text/javascript"> <script type="text/javascript">
function submit_form(obj) function submit_form(obj)
{ {
hideModal(obj);
$("#new-watcher-form").submit(); $("#new-watcher-form").submit();
} }

@ -1,6 +1,6 @@
<% <%
id = "finish_course_#{course.id}" id = "finish_course_#{course.id}"
display = (course.teacher.id == User.current.id || User.current.admin?) display = (User.current.allowed_to?(:as_teacher,course) || User.current.admin?)
%> %>
<% if display #如果课程已结束%> <% if display #如果课程已结束%>

@ -4,7 +4,7 @@
<% if @state %> <% if @state %>
<% if @state == 0 %> <% if @state == 0 %>
alert("加入成功"); alert("加入成功");
hideModal("#popbox02"); hideModal($("#popbox"));
<% elsif @state == 1 %> <% elsif @state == 1 %>
alert("密码错误"); alert("密码错误");
<% elsif @state == 2 %> <% elsif @state == 2 %>

@ -17,17 +17,17 @@
<h2><%= @member_score.user.name %> 历次作业积分</h2> <h2><%= @member_score.user.name %> 历次作业积分</h2>
<ul class="tscore_box"> <ul class="tscore_box">
<li ><span class="c_blue02 w280">作业名称</span><span class="c_blue02 w70">得分</span></li> <li ><span class="c_blue02 w280">作业名称</span><span class="c_blue02 w70">得分</span></li>
<% @member_score.student_homework_score[0].each do |homework_score| %> <% @member_score.student_work_score.each do |homework_score| %>
<li> <li>
<span class="c_grey02 w280"> <span class="c_grey02 w280">
<%= homework_score.name %> <%= homework_score.name %>
</span> </span>
<span class="c_red w70"> <span class="c_red w70">
<%= format("%0.2f",homework_score[:score].nil? ? 0 : homework_score[:score]) %> <%= format("%0.2f",homework_score.final_score.nil? ? 0 : homework_score.final_score) %>
</span> </span>
</li> </li>
<% end %> <% end %>
<li><span class="c_blue03 w280">作业积分(总得分)</span><span class="c_red w70"><%= @member_score.student_homework_score[1] %></span></li> <li><span class="c_blue03 w280">作业积分(平均分)</span><span class="c_red w70"><%= @member_score.student_work_score_avg %></span></li>
</ul> </ul>
</div> </div>

@ -1,14 +1,20 @@
<div class="project_r_h"> <div class="project_r_h">
<% if @controller_name=='ActivityNotifys' %> <% if @controller_name=='ActivityNotifys' %>
<a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a> <a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2">与我相关</h2> <h2 class="fl project_h2" style="width:100px;">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</h2>
<div class="fr mt10 mr5 c_grey02"> <div class="fr mt10 mr5 c_grey02">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label> <a class="c_dblue">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</a>
</div> </div>
<% else %> <% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2> <h2 class="fl project_h2"><%= l(:label_activity)%></h2>
<% if User.current.logged? %> <% if User.current.logged? %>
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关</a> <a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</a>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@ -35,20 +41,23 @@
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%if @controller_name=='ActivityNotifys' && !e.get_notify_is_read%> <%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span> <span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
<%end%> <%end%>
<br /> <br />
<p class="mt5 break_word"><%= e.event_description.html_safe %> <p class="mt5 break_word"><%= e.event_description.html_safe %>
<br /> <br />
<div class="cl"></div>
<%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %> <%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p> </p>
<%= link_to_attachments_course(e) if e.is_a?(News) %> <%= link_to_attachments_course(e) if e.class.to_s == "News" %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--课程动态 end--> </div><!--课程动态 end-->
<% end%> <% end%>
<% end%> <% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%> <% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %> <% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main"> <div class="problem_main">
@ -76,6 +85,14 @@
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
function nh_new_notify_count_show(){
var new_notify_count = $("#new_notify_count").html();
if(new_notify_count>0){
$("#new_notify_count").parent('span').show();
}else{
$("#new_notify_count").parent('span').hide();
}
}
$("div[nhname='container']").each(function(){ $("div[nhname='container']").each(function(){
var container = $(this); var container = $(this);
var btn = $("a[nhname='nh_act_link']",container); var btn = $("a[nhname='nh_act_link']",container);
@ -88,6 +105,8 @@
$.ajax({url:url,dataType:'text',success:function(data){ $.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){ if(data == 'true'){
flag.remove(); flag.remove();
$("#new_notify_count").html($("#new_notify_count").html()-1);
nh_new_notify_count_show();
} }
}}); }});
} }
@ -100,8 +119,11 @@
$.ajax({url:url,dataType:'text',success:function(data){ $.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){ if(data == 'true'){
$("span[nhname='nh_act_flag']").remove(); $("span[nhname='nh_act_flag']").remove();
$("#new_notify_count").html('0');
nh_new_notify_count_show();
} }
}}); }});
}); });
nh_new_notify_count_show();
}); });
</script> </script>

@ -31,7 +31,7 @@
} }
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }

@ -25,21 +25,22 @@
<% if file.is_public? || User.current.member_of_course?(course) %> <% if file.is_public? || User.current.member_of_course?(course) %>
<div class="re_con_box" id="container_files_<%= file.id %>"> <div class="re_con_box" id="container_files_<%= file.id %>">
<div class=""> <div class="">
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %> <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %> <% if User.current.logged? %>
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
<span id="is_public_<%= file.id %>"> <span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
</span> </span>
<% else %> <% else %>
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> --> <!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %> <% end %>
<% else %> <% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% end %> <% end %>
<%= link_to_attachment file, text: '下载', class: 'f_l re_open' %>
<% else %> <% else %>
<% end %> <% end %>
</div> </div>
@ -65,4 +66,4 @@
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

@ -18,7 +18,7 @@
<% project_attachments.each do |file| %> <% project_attachments.each do |file| %>
<div class="re_con_box"> <div class="re_con_box">
<div class=""> <div class="">
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %> <% if User.current.logged? %>
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %> <% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
@ -30,6 +30,7 @@
<% else %> <% else %>
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% end %> <% end %>
<%= link_to_attachment file, text: '下载', class: 'f_l re_open' %>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -37,7 +38,7 @@
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p> <p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file), <%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%> :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p> <p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="tag_h"> <div class="tag_h">
@ -51,4 +52,4 @@
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

@ -5,7 +5,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>');
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().css("top","40%").css("left","36%");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }

@ -6,6 +6,6 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

@ -6,6 +6,6 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#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').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","30%").css("left","35%"); $('#ajax-modal').parent().css("top","30%").css("left","35%");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

@ -4,19 +4,20 @@
<span class="c_red">*</span> <span class="c_red">*</span>
&nbsp;<%= l(:field_name)%>&nbsp; &nbsp;<%= l(:field_name)%>&nbsp;
</label> </label>
<input type="text" name="homework_common[name]" id="homework_name" class="w548 h26 fl" maxlength="<%= Bid::NAME_LENGTH_LIMIT%>" onkeyup="regex_homework_name();" value="<%= homework.name%>" > <input type="text" name="homework_common[name]" id="homework_name" class="w548 h26 fl" maxlength="255" onkeyup="regex_homework_name();" value="<%= homework.name%>" >
<p id="homework_name_span" class="c_red ml110"></p> <p id="homework_name_span" class="c_red ml110"></p>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li > <li >
<label class="label02 ">&nbsp;&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;</label> <label class="label02 ">&nbsp;&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;</label>
<!--<textarea name="" placeholder="请在此填入作业的要求及评分依据" class=" w548 h150 mb10 fl" ></textarea>--> <div style="width: 83%;float: left;">
<% if edit_mode %> <% if edit_mode %>
<%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
<% else %> <% else %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor' %> <%= f.kindeditor :description,:editor_id => 'homework_description_editor' %>
<% end %> <% end %>
</div>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="mt10"> <li class="mt10">

@ -0,0 +1,90 @@
<ul class="hwork_new_basic">
<li >
<label class="label02 mb20">
<span class="c_red">*</span>
&nbsp;<%= l(:field_name)%>&nbsp;
</label>
<input type="text" name="homework_common[name]" id="homework_name" class="w548 h26 fl" maxlength="255" onkeyup="regex_homework_name();" value="<%= homework.name%>" >
<p id="homework_name_span" class="c_red ml110"></p>
</li>
<div class="cl"></div>
<li >
<label class="label02 ">&nbsp;&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;</label>
<div style="width: 83%;float: left;">
<% if edit_mode %>
<%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
<% else %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description,:editor_id => 'homework_description_editor' %>
<% end %>
</div>
</li>
<div class="cl"></div>
<li class="mt10">
<label class="label02">&nbsp;&nbsp;附件:&nbsp;</label>
<%= render :partial => 'attachments/new_form', :locals => {:container => homework} %>
</li>
<div class="cl"></div>
<li class="fl">
<label class="label02">
<span class="c_red">*</span>
&nbsp;<%= l(:label_limit_time)%>&nbsp;
</label>
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.end_time%>" >
<%= calendar_for('homework_end_time')%>
<div class="cl"></div>
</li>
<li class="fl ml100" style="display: none;">
<label class="label02">&nbsp;发布日期:&nbsp;</label>
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.publish_time%>" >
<%= calendar_for('homework_publish_time')%>
<div class="cl"></div>
</li>
<div class="cl"></div>
<li style="display: none;">
<label class="label02">迟交扣分:&nbsp;</label>
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
<span class="fl mt5">&nbsp;分</span>
<div class="cl"></div>
</li>
</ul><!--hwork_new_basic end--->
<div class="hwork_new_set">
<p class="fl ml20 f14 mb10 c_orange">编程评测设置</p>
<div class="cl"></div>
<ul>
<li >
<label class="label02">&nbsp;开发语言:&nbsp;</label>
<select class="fl mb10 h26 w150" >
<option>C++</option>
</select>
<div class="cl"></div>
</li>
<li >
<label class="label02">&nbsp;标准代码:&nbsp;</label>
<textarea name="standard_code" class=" w547 h150 mb10 fl"><%= homework.homework_detail_programing.standard_code%></textarea>
<div class="cl"></div>
</li>
<% if edit_mode %>
<% else %>
<div>
<li>
<label class="label02">&nbsp;测试输入:&nbsp;</label>
<input type="text" class="fl h26 w186 mb10" name="input[0]" />
</li>
<li >
<label class=" fl f14 ml10">&nbsp;输出:&nbsp;</label>
<input type="text" class="fl h26 w186 mb10" name="output[0]" />
</li>
<li>
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
<span class="green_btn fl ml5 mt1">测试</span>
</li>
<div class="cl"></div>
</div>
<% end %>
</ul>
</div>

@ -8,7 +8,7 @@
</div> </div>
<div class="hwork_new"> <div class="hwork_new">
<%= form_for @homework do |f| %> <%= form_for @homework do |f| %>
<%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a> <a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%> <% end%>

@ -16,9 +16,9 @@
<div class="problem_main"> <div class="problem_main">
<%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %> <%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %>
<div class="problem_txt fl mt5"> <div class="problem_txt fl mt5">
<%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl') %> <%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl',:target => "_blank") %>
<span class="fl"> <%= l(:label_user_create_project_homework) %></span> <span class="fl"> <%= l(:label_user_create_project_homework) %></span>
<%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue') %> <%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue',:target => "_blank") %>
<div class="cl mb5"></div> <div class="cl mb5"></div>
<p class="fl "> <p class="fl ">
<%= l(:lebel_homework_commit)%> <%= l(:lebel_homework_commit)%>
@ -41,9 +41,9 @@
<%= homework.description.html_safe %> <%= homework.description.html_safe %>
</div> </div>
</div> </div>
<div class="news_foot c_red" id="bid_show_more_des_button<%= homework.id%>" onclick="bid_show_more_des(<%= homework.id%>);" style="cursor:pointer;display: none;">
<%= l(:button_more)%>... <div class="news_foot currentDd" id="bid_show_more_des_button<%= homework.id%>" onclick="bid_show_more_des(<%= homework.id%>);" style="cursor:pointer;display: none;">
<span class="g-arr-down"></span> [展开]
</div> </div>
<div class="cl"></div> <div class="cl"></div>

@ -1,17 +1,27 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= error_messages_for 'homework_common' %>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"> <h2 class="project_h2">
<%= l(:label_course_homework_new)%> <%= l(:label_course_homework_new)%>
</h2> </h2>
</div> </div>
<div class="hwork_new"> <div class="hwork_new" id="hwork_new">
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
<%= hidden_field_tag "course",@course.id%> <input type="hidden" name="course" value="<%= @course.id%>">
<%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> <h3 class="c_blue f16 mb10">
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a> 请选择将要发布的作业类型
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> </h3>
<input type="radio" class="mb10 fl" name="homework_common_type" value="1" id="homework_detail_manual_radio" checked/>
<span class="ml5 fl">
人工评分的作业(支持匿名互评、灵活设置评分比例)
</span>
<div class="cl"></div>
<input type="radio" class="mb20 fl" name="homework_common_type" value="2" id="homework_detail_programing_radio"/>
<span class="ml5 fl">
自动评测的编程作业支持C++程序的自动评分)
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class=" orange_btn" onclick="$(this).parent().submit();">
下一步
</a>
<% end%> <% end%>
</div><!--hwork_new end--> </div><!--hwork_new end-->
<div class="cl"></div> <div class="cl"></div>

@ -0,0 +1,30 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= error_messages_for 'homework_common' %>
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_course_homework_new)%>
</h2>
</div>
<% if @homework_type == "1"%>
<div class="hwork_new">
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
<%= hidden_field_tag "course",@course.id%>
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
</div><!--hwork_new end-->
<% elsif @homework_type == "2"%>
<div class="hwork_new">
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
<%= hidden_field_tag "course",@course.id%>
<%= hidden_field_tag "homework_common[homework_type]","2"%>
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
</div><!--hwork_new end-->
<div class="cl"></div>
<% end%>

@ -20,19 +20,6 @@
<li id="current_user_li"> <li id="current_user_li">
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, target:"_blank", :class => "uses_name"%> <%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, target:"_blank", :class => "uses_name"%>
<ul id="user_sub_menu" style="right: 0px;display: none;"> <ul id="user_sub_menu" style="right: 0px;display: none;">
<% 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.host_name},target:"_blank", :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.host_name }, target:"_blank" %>
</li>
<% end %>
</ul>
</li>
<% end %>
<% if @show_course == 1 && User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) %> <% 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%> <% user_course = get_user_course User.current%>
<% unless user_course.empty? %> <% unless user_course.empty? %>
@ -48,6 +35,19 @@
</li> </li>
<% end %> <% end %>
<% end %> <% end %>
<% 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.host_name},target:"_blank", :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.host_name }, target:"_blank" %>
</li>
<% end %>
</ul>
</li>
<% end %>
<li> <li>
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%> <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
</li> </li>

@ -48,7 +48,7 @@
</div> </div>
<div class="search fl"> <div class="search fl">
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get, :class => "search_form") do %> <%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get, :class => "search_form") do %>
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_course_name), :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %> <input class="search_text fl" id="name" name="name" onkeyup="regexName('搜索条件不能为空');" placeholder="课程名称" type="text">
<a href="javascript:void(0)" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" > <a href="javascript:void(0)" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
<%= l(:label_search)%> <%= l(:label_search)%>
</a> </a>

@ -107,7 +107,9 @@
<!--邀请加入--> <!--邀请加入-->
<div class="subNavBox"> <div class="subNavBox">
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit"><%= l(:label_invite)%></div> <div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit" data-val="expand">
<%= l(:label_invite)%>
</div>
<ul class="navContent " style="display:block" id="navContent_invit"> <ul class="navContent " style="display:block" id="navContent_invit">
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li> <li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
<% if User.current.allowed_to?(:manage_members, @project) %> <% if User.current.allowed_to?(:manage_members, @project) %>

@ -218,9 +218,8 @@
</td> </td>
</tr> </tr>
<% end %> <% end %>
<% unless @user.user_extensions.nil?&&@user.user_extensions.location.empty?%> <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%>
<tr> <tr>
<td style=" float: right" width="70px"> <td style=" float: right" width="70px">
<span style="float: right"> <%= l(:label_location) %></span> <span style="float: right"> <%= l(:label_location) %></span>
</td> </td>

@ -23,7 +23,7 @@
</li> </li>
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span> <li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px"> <span style="float: left; width: 526px">
<%= @message.content %> <%= @message.content.html_safe %>
</span> </span>
</li> </li>

@ -3,88 +3,64 @@
<%= @subject %> <%= @subject %>
</h4> </h4>
<% if @attachments.first || @course_news.first || @bids.first || <% if @attachments.first || @course_news.first || @bids.first ||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %> @course_journal_messages.first|| @course_messages.first || @attachments.first %>
<div class="wmail_main" style="padding:20px 10px 0px;"> <div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2> <h3 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h3>
<% unless @course_news.first.nil? %> <% unless @course_news.first.nil? %>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_news) %> <%= l(:label_course_news) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_news.count %>)</span> </span>
</h4>
<% @course_news.each do |course_new|%> <% @course_news.each do |course_new|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value), <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name", <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_notice) %></span>
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value), <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(course_new.created_on) %></span>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</ul><!--课程通知 end--> </ul><!--课程通知 end-->
<% end %> <% end %>
<!--课程作业--> <!--课程作业-->
<% if !@bids.first.nil? || !@homeworks.first.nil? %> <% unless @bids.empty? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4> <span class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;">
<%= l(:label_homework_overview) %>
</span>
<% unless @bids.first.nil?%> <% unless @bids.first.nil?%>
<% @bids.each do |bid| %> <% @bids.each do |bid| %>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value), <%= link_to truncate(bid.course.name,length: 30,omission: '...'), course_url(bid.course, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name", <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_course_homework) %></span>
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value), <%= link_to truncate(bid.name,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(bid.created_at) %></span>
</li>
<% end %>
<% end %>
<% unless @homeworks.first.nil? %>
<% @homeworks.each do |homework| %>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_submit_homework) %></span>
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_at) %></span>
</li> </li>
<% end %> <% end %>
<% end %> <% end %>
@ -95,31 +71,30 @@
<!-- 课程留言 --> <!-- 课程留言 -->
<% unless @course_journal_messages.first.nil? %> <% unless @course_journal_messages.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:view_course_journals_for_messages) %> <%= l(:view_course_journals_for_messages) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span> </span>
</h4>
<% @course_journal_messages.each do |course_journal_message|%> <% @course_journal_messages.each do |course_journal_message|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value), <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name", <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_journals_for_messages) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_send_course_journals_for_messages) %></span>
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value), <%= link_to truncate(course_journal_message.notes.html_safe,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(course_journal_message.created_on) %></span>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
@ -128,26 +103,25 @@
<!-- 课程讨论区 --> <!-- 课程讨论区 -->
<% unless @course_messages.first.nil? %> <% unless @course_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:view_borad_course) %> <%= l(:view_borad_course) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span> </span>
</h4>
<% @course_messages.each do |course_message|%> <% @course_messages.each do |course_message|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value), <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name", <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_send_course_messages) %></span>
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value), <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(course_message.created_on) %></span>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
@ -156,31 +130,29 @@
<!-- 课件 --> <!-- 课件 -->
<% unless @attachments.first.nil? %> <% unless @attachments.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_attendingcontestwork_download) %> <%= l(:label_course_attendingcontestwork_download) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @attachments.count %>)</span> </span>
</h4>
<% @attachments.each do |attachment|%> <% @attachments.each do |attachment|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value), <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name", <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_file_upload) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_course_file_upload) %></span>
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value), <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(attachment.created_on) %></span>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
@ -189,34 +161,30 @@
</div> </div>
<% end %> <% end %>
<!--项目相关--> <!--项目相关-->
<% if @issues.first || @project_messages.first %> <% if @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %>
<div class="wmail_main" style="padding:20px 10px 0px;"> <div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2> <h3 class="wmail_h2" style="color:#15BCCF; "><%= l(:label_project_overview_new)%></h3>
<% unless @issues.first.nil? %> <% unless @issues.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:label_issue_tracking) %> <%= l(:label_issue_tracking) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @issues.count %>)</span> </span>
</h4>
<% @issues.each do |issue|%> <% @issues.each do |issue|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value), <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name", <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_issue) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_issue) %></span>
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value), <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
:class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(issue.created_on) %></span>
</li> </li>
<% end %> <% end %>
@ -226,31 +194,29 @@
<!-- 讨论区 --> <!-- 讨论区 -->
<% unless @project_messages.first.nil? %> <% unless @project_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:project_moule_boards_show) %> <%= l(:project_moule_boards_show) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_messages.count %>)</span> </span>
</h4>
<% @project_messages.each do |project_message|%> <% @project_messages.each do |project_message|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value), <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name", <%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_send_course_messages) %></span>
<%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value), <%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_message.created_on) %></span>
</li> </li>
<% end %> <% end %>
@ -258,50 +224,109 @@
</ul><!--项目论坛 end--> </ul><!--项目论坛 end-->
<% end %> <% end %>
<!--项目wiki-->
<% unless @wiki_contents.first.nil? %>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:label_wiki) %>
</span>
<% @wiki_contents.each do |wikicontent|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<% end %>
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value), :class => "wmail_name",
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_wiki_mail_notification) %></span>
<% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value),
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<% end %>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(wikicontent.updated_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!-- 项目wikiend -->
<% end %>
<!--项目新闻--> <!--项目新闻-->
<% unless @project_news.first.nil? %> <% unless @project_news.first.nil? %>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_news) %> <%= l(:label_project_news) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_news.count %>)</span> </span>
</h4>
<% @project_news.each do |project_new|%> <% @project_news.each do |project_new|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value), <%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value), :class => "wmail_name", <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_mail_notice) %></span>
<%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value), <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
%> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_new.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_new.created_on) %></span>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</ul><!-- 项目新闻end --> </ul><!-- 项目新闻end -->
<% end %> <% end %>
<!--项目留言-->
<% unless @project_journal_messages.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:label_project_mail_feedback) %>
</span>
<% @project_journal_messages.each do |project_journal_message|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
<%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value), :class => "wmail_name",
:style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_send_course_journals_for_messages) %></span>
<%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value),
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_journal_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--项目留言 end-->
<% end %>
</div> </div>
<% end %><!-- 项目动态end --> <% end %><!-- 项目动态end -->
<!-- 用户留言 --> <!-- 用户留言 -->
<% unless @user_journal_messages.first.nil? %> <% unless @user_journal_messages.first.nil? %>
<div class="wmail_main" style="padding:20px 10px 0px;"> <div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2> <h3 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h3>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_message) %> <%= l(:label_user_message) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @user_journal_messages.count %>)</span> </span>
</h4>
<% @user_journal_messages.each do |user_journal_message|%> <% @user_journal_messages.each do |user_journal_message|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
@ -309,14 +334,14 @@
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value), <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
:class => "wmail_name", :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_show_your_message) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_show_your_message) %></span>
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value), <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(user_journal_message.created_on) %></span></li> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(user_journal_message.created_on) %></span></li>
<% end %> <% end %>
@ -327,13 +352,13 @@
<% end %> <% end %>
<% if @forums.first || @memos.first %> <% if @forums.first || @memos.first %>
<div class="wmail_main" style="padding:20px 10px 0px;"> <div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:lable_bar_active) %></h2> <h3 class="wmail_h2" style="color:#15bccf; "><%= l(:lable_bar_active) %></h3>
<% unless @forums.first.nil? %> <% unless @forums.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_forum) %> <%= l(:label_user_forum) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span> <span class="wmail_num" style="color:#666; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span>
</h4> </span>
<% @forums.each do |forum|%> <% @forums.each do |forum|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
@ -341,14 +366,14 @@
<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value), <%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value),
:class => "wmail_name", :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_forum_new) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_forum_new) %></span>
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value), <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(forum.created_at) %></span></li> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(forum.created_at) %></span></li>
<% end %> <% end %>
@ -356,11 +381,10 @@
</ul><!-- 新建贴吧 end--> </ul><!-- 新建贴吧 end-->
<% end %> <% end %>
<% unless @memos.first.nil? %> <% unless @memos.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_message_forum) %> <%= l(:label_user_message_forum) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @memos.count %>)</span> </span>
</h4>
<% @memos.each do |memo|%> <% @memos.each do |memo|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
@ -368,14 +392,14 @@
<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value), <%= link_to memo.author, user_activities_url(memo.author,:token => @token.value),
:class => "wmail_name", :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %></span>
<%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id)), <%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id)),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(memo.created_at) %></span></li> <span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(memo.created_at) %></span></li>
<% end %> <% end %>
@ -385,6 +409,7 @@
</div><!--贴吧动态 end--> </div><!--贴吧动态 end-->
<% end %> <% end %>
<div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;"> <div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;">
<span style="color:#666;"><%= l(:label_mail_policy) %></span>
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %> <% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label> <label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>

@ -1,10 +1,10 @@
<%= @subject %> <%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first || <% if @attachments.first || @course_news.first || @bids.first ||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %> @course_journal_messages.first|| @course_messages.first %>
<%= l(:label_course_overview)%> <%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %> <% unless @course_news.first.nil? %>
<%= l(:label_course_news) %> <%= l(:label_course_news) %>
(<%= @course_news.count %>)
<% @course_news.each do |course_new|%> <% @course_news.each do |course_new|%>
@ -15,60 +15,40 @@
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%> <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%>
] ]
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value)
%> %>
<%= l(:label_project_notice) %> <%= l(:label_project_notice) %>
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value) <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value)
%> <%= format_time(course_new.created_on) %> %> <%= format_time(course_new.created_on) %>
<% end %> <% end %>
<% end %> <% end %>
<% if !@bids.first.nil? || !@homeworks.first.nil? %> <% unless @bids.empty? %>
<%= l(:label_homework_overview) %><%= @bids.count %> <%= l(:label_homework_overview) %>
<% unless @bids.first.nil?%> <% unless @bids.first.nil?%>
<% @bids.each do |bid| %> <% @bids.each do |bid| %>
[ [
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'),course_url(bid.courses.first, :token => @token.value) <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value)
%> %>
] ]
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value) <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value)
%> %>
<%= l(:label_course_homework) %> <%= l(:label_course_homework) %>
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(bid,:token => @token.value) <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value)
%>
<%= format_time(bid.created_on) %>
<% end %>
<% end %>
<% unless @homeworks.first.nil? %>
<% @homeworks.each do |homework| %>
▪[
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value)
%>
]
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value)
%>
<%= l(:label_course_submit_homework) %>
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value)
%> %>
<%= format_time(homework.created_at) %> <%= format_time(bid.created_at) %>
<% end %> <% end %>
<% end %> <% end %>
@ -78,7 +58,7 @@
<% unless @course_journal_messages.first.nil? %> <% unless @course_journal_messages.first.nil? %>
<%= l(:view_course_journals_for_messages) %> (<%= @course_journal_messages.count %>) <%= l(:view_course_journals_for_messages) %>
<% @course_journal_messages.each do |course_journal_message|%> <% @course_journal_messages.each do |course_journal_message|%>
@ -86,17 +66,17 @@
[ [
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value) <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value)
%> %>
] ]
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value) <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value)
%> %>
<%= l(:label_send_course_journals_for_messages) %> <%= l(:label_send_course_journals_for_messages) %>
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value) <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value)
%> %>
<%= format_time(course_journal_message.created_on) %> <%= format_time(course_journal_message.created_on) %>
@ -108,7 +88,7 @@
<% unless @course_messages.first.nil? %> <% unless @course_messages.first.nil? %>
<%= l(:view_borad_course) %> <%= l(:view_borad_course) %>
(<%= @course_journal_messages.count %>)
<% @course_messages.each do |course_message|%> <% @course_messages.each do |course_message|%>
@ -117,7 +97,7 @@
[ [
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value) <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value)
%> %>
] ]
@ -126,8 +106,8 @@
<%= l(:label_send_course_messages) %> <%= l(:label_send_course_messages) %>
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value) <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value)
%> %>
<%= format_time(course_message.created_on) %> <%= format_time(course_message.created_on) %>
@ -139,14 +119,14 @@
<% unless @attachments.first.nil? %> <% unless @attachments.first.nil? %>
<%= l(:label_course_attendingcontestwork_download) %> <%= l(:label_course_attendingcontestwork_download) %>
(<%= @attachments.count %>)
<% @attachments.each do |attachment|%> <% @attachments.each do |attachment|%>
▪[ ▪[
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value) <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value)
%> %>
] ]
@ -155,8 +135,8 @@
<%= l(:label_course_file_upload) %> <%= l(:label_course_file_upload) %>
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value) <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value)
%> %>
<%= format_time(attachment.created_on) %> <%= format_time(attachment.created_on) %>
</li> </li>
@ -166,19 +146,19 @@
<% end %> <% end %>
<% end %><!--课程动态 end--> <% end %><!--课程动态 end-->
<% @issues.first || @project_messages.first %> <% @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %>
<%= l(:label_project_overview_new)%> <%= l(:label_project_overview_new)%>
<% unless @issues.first.nil? %> <% unless @issues.first.nil? %>
<%= l(:label_issue_tracking) %> <%= l(:label_issue_tracking) %>
(<%= @issues.count %>)
<% @issues.each do |issue|%> <% @issues.each do |issue|%>
[ [
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value) <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value)
%> %>
] ]
@ -187,8 +167,8 @@
<%= l(:label_project_issue) %> <%= l(:label_project_issue) %>
<%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value) <%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value)
%> %>
<%= format_time(issue.created_on) %> <%= format_time(issue.created_on) %>
<% end %> <% end %>
@ -199,13 +179,13 @@
<% unless @project_messages.first.nil? %> <% unless @project_messages.first.nil? %>
<%= l(:project_moule_boards_show) %> <%= l(:project_moule_boards_show) %>
(<%= @project_messages.count %>)
<% @project_messages.each do |project_message|%> <% @project_messages.each do |project_message|%>
▪[ ▪[
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value) <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value)
%> %>
] ]
@ -214,12 +194,74 @@
<%= l(:label_send_course_messages) %> <%= l(:label_send_course_messages) %>
<%= link_to truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) <%= link_to truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value)
%> %>
<%= format_time(project_message.created_on) %> <%= format_time(project_message.created_on) %>
<% end %> <% end %>
<% unless @wiki_contents.first.nil? %>
<%= l(:label_wiki) %>
<% @wiki_contents.each do |wikicontent|%>
▪[
<% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value)
%>
<% end %>
]
<%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %>
<%= l(:label_project_notice) %>
<% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %>
<% end %>
<%= format_time(wikicontent.updated_on) %>
<% end %>
<% end %>
<!--项目新闻-->
<% unless @project_news.first.nil? %>
<%= l(:label_project_news) %>
<% @project_news.each do |project_new|%>
▪[
<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value)
%>
]
<%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value)
%>
<%= l(:label_project_notice) %>
<%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value)
%>
<%= format_time(project_new.created_on) %>
<% end %>
<% end %>
<!--项目留言-->
<% unless @project_journal_messages.first.nil? %>
<%= l(:label_project_mail_feedback) %>
<% @project_journal_messages.each do |project_journal_message|%>
▪[
<%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value)
%>
]
<%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %>
<%= l(:label_send_course_journals_for_messages) %>
<%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value)
%>
<%= format_time(project_journal_message.created_on) %>
<% end %>
<% end %>
<% end %> <% end %>
@ -235,13 +277,13 @@
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value) <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value)
%> %>
<%= l(:label_show_your_message) %> <%= l(:label_show_your_message) %>
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value) <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value)
%> %>
<%= format_time(user_journal_message.created_on) %> <%= format_time(user_journal_message.created_on) %>
@ -254,7 +296,7 @@
<% unless @forums.first.nil? %> <% unless @forums.first.nil? %>
<%= l(:label_user_forum) %> <%= l(:label_user_forum) %>
(<%= @forums.count %>)
<% @forums.each do |forum|%> <% @forums.each do |forum|%>
@ -273,7 +315,7 @@
<% unless @memos.first.nil? %> <% unless @memos.first.nil? %>
<%= l(:label_user_message_forum) %> <%= l(:label_user_message_forum) %>
(<%= @memos.count %>)
<% @memos.each do |memo|%> <% @memos.each do |memo|%>

@ -4,9 +4,9 @@
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span> <li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px"> <span style="float: left; width: 526px">
<p><%= @subject %> </p> <p><%= @subject %> </p>
<p> <%= link_to @project_url, @project_url%></p> <p style="color: #15BCCF ">点击下面的链接即可激活账号系统会根据给出的密码和账号自动登录Trustie平台。</p>
<p>点击链接后,将自动为您注册账号</p> <p> <%= link_to @project_url, @project_url%></p>
<p>您的账号为:<%= @email %></p> <p>您的账号为:<%= @email %></p>
<p>密码为: <%= @password %></p> <p>密码为: <%= @password %></p>

@ -1,3 +1,3 @@
<p><%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url), <p><%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
:author => h(@wiki_content.author)).html_safe %><br /> :author => h(@wiki_content.author)).html_safe %><br />
<em><%=h @wiki_content.comments %></em></p> <em><%=h @wiki_content.comments.html_safe %></em></p>

@ -131,9 +131,9 @@
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
</td> </td>
<td class="comments" style="word-wrap: break-word;word-break: break-all;"> <td class="comments" style="word-wrap: break-word;word-break: break-all;">
<div class="reply_content" > <div class="reply_content" >
<%=h sanitize(reply.content.html_safe) %> <%=h sanitize(reply.content.html_safe) %>
</div> </div>
<p> <p>
<% if reply.attachments.any?%> <% if reply.attachments.any?%>
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
@ -183,4 +183,4 @@
}); });
}; };
$("img").removeAttr("align"); $("img").removeAttr("align");
</script> </script>

@ -8,11 +8,15 @@
<% if is_new %> <% if is_new %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label> <label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= f.kindeditor :description,:width=>'91%',:editor_id=>'news_description_editor' %> <div class="fl" style="width: 91%">
<%= f.kindeditor :description,:editor_id=>'news_description_editor' %>
</div>
<p id="description_notice_span" class="ml55"></p> <p id="description_notice_span" class="ml55"></p>
<% else %> <% else %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label> <label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= f.kindeditor :description,:width=>'91%',:editor_id=>'news_description_editor',:owner_id => @news.id,:owner_type => OwnerTypeHelper::NEWS %> <div class="fl" style="width: 91%">
<%= f.kindeditor :description,:editor_id=>'news_description_editor',:owner_id => @news.id,:owner_type => OwnerTypeHelper::NEWS %>
</div>
<p id="description_notice_span" class="ml55"></p> <p id="description_notice_span" class="ml55"></p>
<% end %> <% end %>

@ -44,12 +44,13 @@
<%= news.description.html_safe %> <%= news.description.html_safe %>
</div> </div>
</div> </div>
<div class="news_foot c_red" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"> <div class="news_foot currentDd" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
<%= l(:button_more)%>... [展开]
<span class="g-arr-down"></span>
</div> </div>
<span class="fl"><%= l(:label_create_time)%><%= format_time(news.created_on)%></span> <span class="fl"><%= l(:label_create_time)%><%= format_time(news.created_on)%></span>
<%= link_to_attachments_course news %> <%= link_to_attachments_course news %>
<div class="cl"></div>
<%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--problem_main end--> </div><!--problem_main end-->

@ -25,7 +25,7 @@
</div> </div>
<% if @news.commentable? %> <% if @news.commentable? %>
<div class="msg_box"> <div class="msg_box fl">
<h4><%= l(:label_comment_add) %></h4> <h4><%= l(:label_comment_add) %></h4>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %> <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
<div class="box" id="news_comment"> <div class="box" id="news_comment">
@ -43,7 +43,7 @@
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<div class="cl"></div>
<% comments = @comments.reverse %> <% comments = @comments.reverse %>
<% comments.each do |comment| %> <% comments.each do |comment| %>
<% next if comment.new_record? %> <% next if comment.new_record? %>

@ -28,7 +28,7 @@
<%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %> <%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), project_news_index_path(@project), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %> <%= link_to l(:button_cancel), project_news_index_path(@project), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
<% else %> <% else %>
<%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %> <%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white'%>
<%= link_to l(:button_cancel), news_path(@news), :class => 'blue_btn grey_btn fl c_white' %> <%= link_to l(:button_cancel), news_path(@news), :class => 'blue_btn grey_btn fl c_white' %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>

@ -1,69 +1,11 @@
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= l(:label_news) %></h2> <h2 class="project_h2"><%= l(:label_news) %></h2>
</div> </div>
<script type="text/javascript">
function regexTitle()
{
var name = $("#news_title").val();
if(name.length ==0)
{
$("#title_notice_span").text("<%= l(:label_title_blank)%>");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
else if(name.length <= 60)
{
$("#title_notice_span").text("<%= l(:label_field_correct)%>");
$("#title_notice_span").css('color','#008000');
return true;
}
else
{
$("#title_notice_span").text("<%= l(:label_title_long)%>");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
}
function submitComment()
{
$("#add_comment_form").submit();
}
function regexDescription()
{
var name = $("#news_description").val();
if(name.length ==0)
{
$("#description_notice_span").text("<%= l(:label_descripition_blank)%>");
$("#description_notice_span").css('color','#ff0000');
$("#description_notice_span").focus();
return false;
}
else
{
$("#description_notice_span").text("<%= l(:label_field_correct)%>");
$("#description_notice_span").css('color','#008000');
return true;
}
}
function submitNews()
{
if(regexTitle() && regexDescription())
{
$("#news-form").submit();
}
}
</script>
<% if authorize_for('news', 'edit') %> <% if authorize_for('news', 'edit') %>
<div id="edit-news" style="display:none;"> <div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news), <%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'project_form', :locals => { :f => f, :is_new => false } %> <%= render :partial => 'project_form', :locals => { :f => f, :is_new => false } %>
<% end %> <% end %>
<div id="preview" class="wiki"></div> <div id="preview" class="wiki"></div>

@ -37,6 +37,13 @@
<li class="polls_de_grey fr ml5">关闭</li> <li class="polls_de_grey fr ml5">关闭</li>
<% end%> <% end%>
<% if poll.polls_status == 1%>
<li class="polls_de_grey fr ml5">导出</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%></li>
<% end%>
<li class="polls_date fr"><%= format_date poll.created_at.to_date%></li> <li class="polls_date fr"><%= format_date poll.created_at.to_date%></li>
<% else%> <% else%>
<% if poll.polls_status == 2%> <% if poll.polls_status == 2%>

@ -1,6 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>');
showModal('ajax-modal', '250px'); showModal('ajax-modal', '270px');
$('#ajax-modal').css('height','100px'); $('#ajax-modal').css('height','110px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' 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>");

@ -9,7 +9,8 @@
<span><%= link_to journal.user, user_path(journal.user), :class => 'c_blue fb fl mb10', :target => "_blank" %> <span><%= link_to journal.user, user_path(journal.user), :class => 'c_blue fb fl mb10', :target => "_blank" %>
</span><span class="c_grey fr"><%= format_time(journal.created_on) %></span> </span><span class="c_grey fr"><%= format_time(journal.created_on) %></span>
<div class="cl"></div> <div class="cl"></div>
<p><%= textilizable journal.notes%></p> <!--<p><%#= textilizable journal.notes%></p>-->
<p><%=journal.notes.html_safe%>
</div> </div>
<div class="ping_disfoot"> <div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>
@ -20,8 +21,9 @@
:class => "delete", :title => l(:button_delete)) %> :class => "delete", :title => l(:button_delete)) %>
<% end %> <% end %>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'', <%#= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<%= link_to l(:label_bid_respond_quote),'javascript:;', {:nhname=>"reply_btn"} %>
<% end %> <% end %>
</span> </span>

@ -21,7 +21,7 @@
.C_form{ margin:20px 0 0 60px;} .C_form{ margin:20px 0 0 60px;}
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; padding-left: 60px;} .C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; padding-left: 60px;}
.C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; } .C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:150px;} .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:140px;}
.width190{ width:190px; height:26px; border-color:#e1e1e1;} .width190{ width:190px; height:26px; border-color:#e1e1e1;}
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;} .C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
.C_form a:hover{ text-decoration:underline;} .C_form a:hover{ text-decoration:underline;}
@ -31,7 +31,6 @@
<script type="text/javascript"> <script type="text/javascript">
function submit_form(obj) function submit_form(obj)
{ {
hideModal(obj);
$("#new-watcher-form").submit(); $("#new-watcher-form").submit();
// alert("申请成功"); // alert("申请成功");
} }
@ -52,25 +51,25 @@
</div> </div>
<div class="C_form"> <div class="C_form">
<%= form_tag({:controller => 'applied_project', <%= form_tag({:controller => 'applied_project',
:action => 'applied_join_project'}, :action => 'applied_join_project'},
:remote => true, :remote => true,
:method => :post, :method => :post,
:id => 'new-watcher-form') do %> :id => 'new-watcher-form') do %>
<ul> <ul>
<li style="padding-top: 15px;"> <li style="padding-top: 15px;">
<span class="tips"><%= l('project.join.id.label')%></span> <span class="tips"><%= l('project.join.id.label')%></span>
<input type="hidden" name="project_join" value="1"> <input type="hidden" name="project_join" value="1">
<input type="hidden" name="user_id" value="<%= User.current.id%>"> <input type="hidden" name="user_id" value="<%= User.current.id %>">
<input class=" width190" name="project_id" id="project_id" type="text" value="" > <input class=" width190" name="project_id" id="project_id" type="text" value="" >
<input type="text" style="display: none"/> <input type="text" style="display: none"/>
</li> </li>
<li class="mB5" style="width: 260px"><%= l('project.join.id.tips')%></li> <li class="mB5" style="width: 260px"><%= l('project.join.id.tips')%></li>
<li> <li>
<a href="#" class="btn" style="margin-left: 50px;" onclick="submit_form(this);"> <a href="#" class="btn" style="margin-left: 50px;" onclick="submit_form(this);">
<%= l(:label_apply_project) %> <%= l(:label_apply_project) %>
</a> </a>
<a href="#" class="btn" style="margin-left: 20px;" onclick="hideModal(this);"> <a href="#" class="btn" style="margin-left: 20px;" onclick="hideModal(this);">
<%= l(:button_cancel)%> <%= l(:button_cancel) %>
</a> </a>
</li> </li>
</ul> </ul>

@ -1,4 +1,18 @@
<div class="msg_box" id='leave-message'> <style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<div class="msg_box" id='leave-message' nhname='new_message' style="height:auto;">
<% reply_allow = JournalsForMessage.create_by_user? User.current %> <% reply_allow = JournalsForMessage.create_by_user? User.current %>
<h4><%= l(:label_user_response) %></h4> <h4><%= l(:label_user_response) %></h4>
<% if !User.current.logged?%> <% if !User.current.logged?%>
@ -12,8 +26,10 @@
<%= form_for('new_form', :method => :post, <%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%>
<%= f.text_area 'project_message', :rows => 3, :cols => 65, <%= f.text_area 'project_message', :rows => 3, :cols => 65,
:placeholder => "#{l(:label_welcome_my_respond)}" %> :placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %>
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr" %> <p nhname="contentmsg"></p>
<div class="fl mt10" style="padding-top:5px;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %>
<% end %> <% end %>
<% end %> <% end %>
@ -24,3 +40,160 @@
</div> </div>
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul> <ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%></ul>
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
return editor;
}
function nh_check_field(params){
var result=true;
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function init_form(params){
// var flag = false;
// if(params.form.attr('data-remote') != undefined ){
// flag = true
// }
// params.form[0].onsubmit = function(){
// if(flag){
// $(this).removeAttr('data-remote');//不这么搞return false没用 花擦花擦
// }
// var is_checked = nh_check_field({
// issubmit:true,
// content:params.editor,
// contentmsg:params.contentmsg,
// textarea:params.textarea
// });
// if(is_checked){
// if(flag){
// alert('add')
// $(this).attr('data-remote','true');
// }
// alert('ok')
// return true;
// }
// return false;
// }
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
// return true; //这个涛哥的firefox不能提交
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
}
return false;
});
}
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
}
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// $("#nhjump").attr('href','#'+params.div_form.attr('id'));
// $("#nhjump")[0].click();
}
},300);
params.textarea.data('init',1);
});
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
// $("a[nhname='cancel_btn']",params.div_form).click(function(){
// nh_reset_form(params);
// });
params.textarea.data('init',1);
}
});
});
});
</script>

@ -19,7 +19,7 @@
<div class="invi_search"> <div class="invi_search">
<input hidden="hidden" value="true" name="flag"> <input hidden="hidden" value="true" name="flag">
<input id="principal_search" class="invi_search_input fl" type="text" placeholder=<%= l(:label_invite_trustie_user_tips) %>> <input id="principal_search" class="invi_search_input fl" type="text" placeholder=<%= l(:label_invite_trustie_user_tips) %>>
<a class="invi_search_btn fl" onclick="observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js',:flag => true) }')">搜索</a> <a class="invi_search_btn fl" onclick="observeSearchfield('principal_search', null, '<%= escape_javascript autocomplete_project_memberships_path(@project, :format => 'js',:flag => true)%> ')">搜索</a>
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js',:flag => true) }')" %> <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js',:flag => true) }')" %>
<div class="cl"></div> <div class="cl"></div>
<div id="principals_for_new_member"> <div id="principals_for_new_member">
@ -48,7 +48,7 @@
<% end %> <% end %>
</ul> </ul>
<div class="cl mb10"></div> <div class="cl mb10"></div>
<a href="#" class="btn_free" onclick="$('#new_membership').submit();"> <a href="javascript:void(0)" class="btn_free" onclick="submit_invite_members()">
<%= l(:label_invite_members)%> <%= l(:label_invite_members)%>
</a> </a>
</div> </div>
@ -67,37 +67,39 @@
var text=$(label).text(); var text=$(label).text();
$(label).attr("title",text); $(label).attr("title",text);
} }
});
function nh_show_err_message(msg){ function nh_show_err_message(msg){
$("#RSide>.flash").remove(); $("#RSide>.flash").remove();
$("#RSide").prepend('<div class="flash error" id="flash_error">'+msg+'</div>'); $("#RSide").prepend('<div class="flash error" id="flash_error">'+msg+'</div>');
} }
$('#new_membership').submit(function(){
var user_ischeck=false; function submit_invite_members()
$("input[name='membership[user_ids][]']").each(function(){ {
if($(this).prop('checked')){ var user_ischeck=false;
user_ischeck=true; $("input[name='membership[user_ids][]']").each(function(){
} if($(this).prop('checked')){
}); user_ischeck=true;
var role_ischeck=false;
$("input[name='membership[role_ids][]']").each(function(){
if($(this).prop('checked')){
role_ischeck=true;
}
});
if(user_ischeck==false && role_ischeck==false){
nh_show_err_message('请选择用户和角色!');
return false;
}
if(user_ischeck==false){
nh_show_err_message('请选择用户!');
return false;
} }
if(role_ischeck==false){ });
nh_show_err_message('请选择角色!'); var role_ischeck=false;
return false; $("input[name='membership[role_ids][]']").each(function(){
if($(this).prop('checked')){
role_ischeck=true;
} }
return true;
}); });
}); if(user_ischeck==false && role_ischeck==false){
nh_show_err_message('请选择用户和角色!');
return false;
}
if(user_ischeck==false){
nh_show_err_message('请选择用户!');
return false;
}
if(role_ischeck==false){
nh_show_err_message('请选择角色!');
return false;
}
$('#new_membership').submit();
}
</script> </script>

@ -79,19 +79,21 @@
<% end %> <% end %>
<%# 邀请用户的状态 %> <%# 邀请用户的状态 %>
<% unless @inviter_lists.blank? %> <% unless @inviter_lists.blank? %>
<div> <div>
<span class="status_inviter">已邀请的用户</span><br/> <% unless @inviters_count.nil? %>
<% @inviter_lists.each do |inviter_list| %> <span class="status_inviter">已加入项目的用户</span><br/>
<%= inviter_list.user.name %><br/> <% @inviters.each do |inv| %>
<%= inv.name unless inv.nil? %><br/>
<% end %> <% end %>
</br> <% end %>
</br>
<% unless @waiters_count.nil? %>
<span class="status_inviter">等待加入项目的用户</span><br/> <span class="status_inviter">等待加入项目的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %> <% @waiters.each do |wai| %>
<% unless inviter_list.user.member_of?(@project) %> <%= wai.name unless wai.nil?%><br/>
<%= inviter_list.user.name %><br/>
<% end %>
<% end %> <% end %>
</div> <% end %>
</div>
<% end %> <% end %>
</div> </div>

@ -70,6 +70,7 @@
:class => "problem_tit fl fb " %> :class => "problem_tit fl fb " %>
<br /> <br />
<p class="mt5 break_word"><%= textAreailizable act,:content %><br /> <p class="mt5 break_word"><%= textAreailizable act,:content %><br />
<div class="cl"></div>
<%= l :label_create_time %> <%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p> <%= l :label_create_time %> <%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

@ -1,54 +1,53 @@
<% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %> <% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %>
<%= if show_revision_graph && revisions && revisions.any? <%= if show_revision_graph && revisions && revisions.any?
indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid| indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid|
url_for( url_for(
:controller => 'repositories', :controller => 'repositories',
:action => 'revision', :action => 'revision',
:id => project, :id => project,
:repository_id => @repository.identifier_param, :repository_id => @repository.identifier_param,
:rev => scmid) :rev => scmid)
end end
render :partial => 'revision_graph', render :partial => 'revision_graph',
:locals => { :locals => {
:commits => indexed_commits, :commits => indexed_commits,
:space => graph_space :space => graph_space
} }
end %> end %>
<%= form_tag( <%= form_tag(
{:controller => 'repositories', :action => 'diff', :id => project, {:controller => 'repositories', :action => 'diff', :id => project,
:repository_id => @repository.identifier_param, :path => to_path_param(path)}, :repository_id => @repository.identifier_param, :path => to_path_param(path)},
:method => :get :method => :get
) do %> ) do %>
<table class="list changesets"> <table class="list changesets">
<thead><tr> <thead><tr>
<th>#</th> <th>#</th>
<th></th> <th></th>
<th></th> <th></th>
<th><%= l(:label_date) %></th> <th><%= l(:label_date) %></th>
<th><%= l(:field_author) %></th> <th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th> <th><%= l(:field_comments) %></th>
</tr></thead> </tr></thead>
<tbody> <tbody>
<% show_diff = revisions.size > 1 %> <% show_diff = revisions.size > 1 %>
<% line_num = 1 %> <% line_num = 1 %>
<% revisions.each do |changeset| %> <% revisions.each do |changeset| %>
<tr class="changeset <%= cycle 'odd', 'even' %>"> <tr class="changeset <%= cycle 'odd', 'even' %>">
<% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %> <% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %>
<%= content_tag(:td, :class => 'id', :style => id_style) do %> <%= content_tag(:td, :class => 'id', :style => id_style) do %>
<%= link_to_revision(changeset, @repository) %> <%= link_to_revision(changeset, @repository) %>
<% end %> <% end %>
<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td> <td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td> <td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td> <td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%= h truncate(changeset.author.to_s, :length => 30) %></td> <td class="author"><%= h truncate(changeset.author.to_s, :length => 30) %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td> <td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
</tr> </tr>
<% line_num += 1 %> <% line_num += 1 %>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<p style="padding-top: 10px;"> <p style="padding-top: 10px;">
<%= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %> <%= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
</p> </p>
<% end %> <% end %>

@ -5,9 +5,8 @@
<div class="repository_con" style="line-height:1.9;"> <div class="repository_con" style="line-height:1.9;">
<div class="repositorytitle" style="float:left;"> <div class="repositorytitle" style="float:left;">
<%= render :partial => 'breadcrumbs', <%= render :partial => 'breadcrumbs',
:locals => {:path => @path, :kind => 'dir', :revision => @rev} %> :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
<%= render :partial => 'navigation' %> <%= render :partial => 'navigation' %>
</div> </div>
<!--contextual end--> <!--contextual end-->
<div class="cl"></div> <div class="cl"></div>
@ -25,18 +24,18 @@
link_to h(repo.name), link_to h(repo.name),
{:controller => 'repositories', :action => 'show', {:controller => 'repositories', :action => 'show',
:id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil}, :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (repo == @repository ? ' selected' : ''), :class => 'repository' + (repo == @repository ? ' selected' : ''),
:class => "mb10 break_word c_orange" }.join('&nbsp|&nbsp').html_safe %>) :class => "mb10 break_word c_orange" }.join('&nbsp|&nbsp').html_safe %>)
</p> </p>
</div> </div>
</div> </div>
<div class="repos_more"><a id="showgithelp" value="show_help" onclick ="showhelpAndScrollTo('repos_git_more'); " class="c_dblue lh23">展开Git操作指南</a></div> <div class="repos_more"><a href="#" id="showgithelp" value="show_help" onclick ="showhelpAndScrollTo('repos_git_more'); " class="c_dblue lh23">展开Git操作指南</a></div>
<div id="repos_git_more"> <div id="repos_git_more">
<br> <br>
<div class=" c_dark f14"> <div class=" c_dark f14">
<p>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码。</p> <p>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码。</p>
<p>通过cmd命令提示符进入代码对应文件夹的根目录假设当前用户的登录名为user版本库名称为demo需要操作的版本库分支为branch。 <p>通过cmd命令提示符进入代码对应文件夹的根目录假设当前用户的登录名为user版本库名称为demo需要操作的版本库分支为branch。
如果是首次提交代码,执行如下命令:</p> 如果是首次提交代码,执行如下命令:</p>
</div> </div>
<div class="repos_explain"> <div class="repos_explain">
<p>git init</p> <p>git init</p>
@ -53,7 +52,7 @@
<p>git push -u origin branch:branch</p> <p>git push -u origin branch:branch</p>
</div> </div>
<!--repos_explain end--> <!--repos_explain end-->
<div class="c_dark f14"> <div class="c_dark f14">
<p>已经有本地库,还没有配置远程地址,打开命令行执行如下:</p> <p>已经有本地库,还没有配置远程地址,打开命令行执行如下:</p>
</div> </div>
@ -68,7 +67,7 @@
<p>git push -u origin branch:branch</p> <p>git push -u origin branch:branch</p>
</div> </div>
<!--repos_explain end--> <!--repos_explain end-->
<div class="c_dark f14"> <div class="c_dark f14">
<p>已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:</p> <p>已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:</p>
</div> </div>
@ -81,7 +80,7 @@
<p>git push origin branch_name</p> <p>git push origin branch_name</p>
</div> </div>
<!--repos_explain end--> <!--repos_explain end-->
<div class="c_dark f14"> <div class="c_dark f14">
<p>从网上获取别人的开源版本库转交到trustie网站上打开命令行执行如下</p> <p>从网上获取别人的开源版本库转交到trustie网站上打开命令行执行如下</p>
</div> </div>
@ -101,56 +100,59 @@
<p><a href="/users/646" class="c_orange">李海</a>提供</p> <p><a href="/users/646" class="c_orange">李海</a>提供</p>
</div> </div>
</div> </div>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %> <!-- 代码库显示 -->
<%= render :partial => 'dir_list' %> <% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<% end %> <%= render :partial => 'dir_list' %>
<% end %>
<%= render_properties(@properties) %> <%= render_properties(@properties) %>
<% if authorize_for('repositories', 'revisions') %>
<% if @changesets && !@changesets.empty? %> <!-- 代码修订 -->
<h3> <% if authorize_for('repositories', 'revisions') %>
<%= l(:label_latest_revision_plural) %> <%# if @changesets && !@changesets.empty? %>
</h3> <h3>
<%= render :partial => 'revisions', <%= l(:label_latest_revision_plural) %>
:locals => {:project => @project, :path => @path, </h3>
:revisions => @changesets, :entry => nil} %> <%= render :partial => 'revisions',
:locals => {:project => @project, :path => @path,
:revisions => @changesets, :entry => nil} %>
<%# end %>
<p style="padding-top: 10px;">
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
sep = '' %>
<% if @repository.supports_all_revisions? && @path.blank? %>
<%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param},
:class => "orange_u_btn" %>
<% sep = '|' %>
<% end %> <% end %>
<p style="padding-top: 10px;"> <% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %>
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0) <%= sep %>
sep = '' %> <%= link_to l(:label_view_revisions),
<% if @repository.supports_all_revisions? && @path.blank? %> {:action => 'changes',
<%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project, :path => to_path_param(@path),
:repository_id => @repository.identifier_param}, :id => @project,
:class => "orange_u_btn" %> :repository_id => @repository.identifier_param,
<% sep = '|' %> :rev => @rev},
<% end %> :class => "orange_u_btn" %>
<% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %>
<%= sep %>
<%= link_to l(:label_view_revisions),
{:action => 'changes',
:path => to_path_param(@path),
:id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev},
:class => "orange_u_btn" %>
<% end %>
</p>
<% if @repository.supports_all_revisions? %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(
:atom, params.merge(
{:format => 'atom', :action => 'revisions',
:id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
<% end %> <% end %>
<% end %> </p>
<% if @repository.supports_all_revisions? %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(
:atom, params.merge(
{:format => 'atom', :action => 'revisions',
:id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
<% end %>
<% end %>
<!-- added by bai --> <!-- added by bai -->
<p class="fb c_dark mt10">查看如何提交代码: <p class="fb c_dark mt10">查看如何提交代码:
<%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %> <%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %>
<%= link_to('English', en_usage_path, :class => "c_blue") %> <%= link_to('English', en_usage_path, :class => "c_blue") %>
<div class="cl"></div> <div class="cl"></div>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %> <%= stylesheet_link_tag "scm" %>

@ -6,13 +6,15 @@
<span> <span>
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</span> </span>
<% else%>
<span class="ml30">--</span>
<% end%> <% end%>
</li> </li>
<li class="hwork_name"> <li class="hwork_name">
<% if is_my_work%> <% if is_my_work%>
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name %> <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02" %>
<% else%> <% else%>
<%= link_to "匿名","javascript:void(0)"%> <%= link_to "匿名","javascript:void(0)", :class => "c_blue02"%>
<% end%> <% end%>
</li> </li>
<li class=" hwork_tit_e" style="width: 410px"> <li class=" hwork_tit_e" style="width: 410px">

@ -61,7 +61,7 @@
</ul> </ul>
<div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>"> <div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%@work.student_works_scores.order("created_at desc").each do |score|%> <%@work.student_works_scores.order("updated_at desc").each do |score|%>
<div id="work_score_<%= score.id%>"> <div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score}%> <%= render :partial => 'student_work_score',:locals => {:score => score}%>
</div> </div>

@ -6,7 +6,7 @@
</span> </span>
</li> </li>
<li class=" hwork_name "> <li class=" hwork_name ">
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name%> <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
</li> </li>
<li class=" hwork_tit"> <li class=" hwork_tit">
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%> <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>

@ -8,7 +8,7 @@
<a href="javascript:void(0);" class="c_orange fl" ><%= score.score%>分</a> <a href="javascript:void(0);" class="c_orange fl" ><%= score.score%>分</a>
<a href="javascript:void(0);" class="fr c_purple mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a> <a href="javascript:void(0);" class="fr c_purple mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a>
<span class=" fr c_grey mr20"> <span class=" fr c_grey mr20">
<%=format_time score.created_at %> <%=format_time score.updated_at %>
</span> </span>
<div class="cl mb5"></div> <div class="cl mb5"></div>
<p class="break_word"> <p class="break_word">

@ -1,5 +1,5 @@
<li class="hwork_num "> <li class="hwork_num ">
<a href="javascript:void(0);" class=" f14 f_b c_dark fl" >学号</a> <span class="c_dark f14 fb fl">学号</span>
</li> </li>
<li class=" hwork_name f14 fb c_dark"> <li class=" hwork_name f14 fb c_dark">
学生姓名 学生姓名

@ -2,7 +2,7 @@ $("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :parti
$('#score_<%= @work.id%>').peSlider({range: 'min'}); $('#score_<%= @work.id%>').peSlider({range: 'min'});
<% if @is_new%> <% if @is_new%>
$("#score_list_<%= @work.id%>").prepend("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>"); $("#score_list_<%= @work.id%>").prepend("<div id='work_score_<%= @score.id%>'><%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %></div>");
<% else %> <% else %>
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>"); $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
<% end%> <% end%>

@ -36,7 +36,7 @@
</span> </span>
<% if @show_all%> <% if @show_all%>
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);"> <input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
<a class="student_work_search fl" onclick="SearchByName($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a> <a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
<% end%> <% end%>
<% if @is_teacher%> <% if @is_teacher%>
<div class="fr"> <div class="fr">

@ -11,7 +11,8 @@
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> --> <!-- <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"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span> <span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span>
<div class="cl"></div> <div class="cl"></div>
<p><%= textilizable journal.notes%></p> <!--<p><%#= textilizable journal.notes%></p>-->
<p><%=journal.notes.html_safe%></p>
</div> </div>
<div class="ping_disfoot"> <div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>
@ -23,8 +24,9 @@
:class => "delete", :title => l(:button_delete)) %> :class => "delete", :title => l(:button_delete)) %>
<% end %> <% end %>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'', <%#= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> {:focus => 'project_respond',:nhname=>'reply_btn', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>'reply_btn'} %>
<% end %> <% end %>
</span> </span>

@ -1,3 +1,17 @@
<style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:600px;}
div.recall_con .reply_btn{margin-left:555px;margin-top:5px;}
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<div class="dis"> <div class="dis">
<div class="msg_box" id='leave-message'> <div class="msg_box" id='leave-message'>
<% reply_allow = JournalsForMessage.create_by_user? User.current %> <% reply_allow = JournalsForMessage.create_by_user? User.current %>
@ -49,3 +63,169 @@
} }
</script> </script>
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
return editor;
}
function nh_check_field(params){
var result=true;
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function init_form(params){
// var flag = false;
// if(params.form.attr('data-remote') != undefined ){
// flag = true
// }
// params.form[0].onsubmit = function(){
// if(flag){
// $(this).removeAttr('data-remote');//不这么搞return false没用 花擦花擦
// }
// var is_checked = nh_check_field({
// issubmit:true,
// content:params.editor,
// contentmsg:params.contentmsg,
// textarea:params.textarea
// });
// if(is_checked){
// if(flag){
// alert('add')
// $(this).attr('data-remote','true');
// }
// alert('ok')
// return true;
// }
// return false;
// }
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
// return true; //这个涛哥的firefox不能提交
//$(this).trigger('submit'); //这个虽然能提交 但是他是个死循环
//$(this)[0].submit(); //用这个form的data-remote='true'没效果了
//肿么破阿 我滴个神 实在不行就用$.ajax()算了
}
return false;
});
}
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
}
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
if($(this).parent('span')==undefined || $(this).parent('span').length==0){
params.container = $(this).parent('div').parent('div');
}else{
params.container = $(this).parent('span').parent('div').parent('div');
}
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// $("#nhjump").attr('href','#'+params.div_form.attr('id'));
// $("#nhjump")[0].click();
}
},300);
params.textarea.data('init',1);
});
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("#new_message_cancel_btn");
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
// $("a[nhname='cancel_btn']",params.div_form).click(function(){
// nh_reset_form(params);
// });
params.textarea.data('init',1);
}
});
});
});
</script>

@ -42,7 +42,7 @@
<%# memberships = user.memberships.all(:conditions => cond) %> <%# memberships = user.memberships.all(:conditions => cond) %>
<% user_courses = user_courses_list(user) %> <% user_courses = user_courses_list(user) %>
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %> <%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
<%= "" unless user_courses.empty? %> <%#= "" unless user_courses.empty? %>
<% for course in user_courses %> <% for course in user_courses %>
<%# if course.name != nil %> <%# if course.name != nil %>
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : '' %> <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : '' %>

@ -30,8 +30,8 @@
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label--> <!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();" ) %> <%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();",:style=>'display:none;' ) %>
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30, :placeholder=>'昵称/姓名/邮箱' %>
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0"> <input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/> <input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>

@ -34,6 +34,9 @@ form #search_type{
-moz-appearance: none; -moz-appearance: none;
text-indent: 0.01px; text-indent: 0.01px;
text-overflow: ''; text-overflow: '';
padding-right:10px;
background-image:url(/images/arrow_expanded.png)!important;
background:no-repeat right;
} }
form #search_by form #search_by
@ -68,16 +71,33 @@ form #search_by
} }
<%#完了把上面东西放到 .css 里%> <%#完了把上面东西放到 .css 里%>
</style> </style>
<!--[if IE]>
<!--<style type="text/css">-->
<!--form #search_type{-->
<!--background:none!important;-->
<!--}-->
<!--</style>-->
<![endif]-->
<script type="text/javascript">
$(function(){
var userAgent = navigator.userAgent.toLowerCase();
if(/trident/.test(userAgent)){
$('form #search_type').css({'background-image':'none!important'});
}
});
</script>
<script type="text/javascript"> <script type="text/javascript">
function searchTypeChange() function searchTypeChange()
{ {
if($("#search_type").val() == "users") if($("#search_type").val() == "users")
{ {
$("#search_by").show(); $("#q").attr('placeholder','昵称/姓名/邮箱');
// $("#search_by").show();
} }
else else
{ {
$("#search_by").hide(); $("#search_by").hide();
$("#q").attr('placeholder',"<%=l('welcome.search.information')%>");
} }
} }
@ -93,7 +113,7 @@ form #search_by
<%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %> <%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %>
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0"> <input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %> <%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
<%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right" ) %> <%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right;display:none;" ) %>
</div> </div>
<%#= hidden_field_tag 'project_type', project_type %> <%#= hidden_field_tag 'project_type', project_type %>
</div> </div>

@ -22,7 +22,7 @@
<% end %> <% end %>
<p> <p>
<%= reply.notes %> <%= reply.notes.html_safe %>
</p> </p>
<span class="c_grey fl"> <span class="c_grey fl">
<%= format_time reply.created_on %> <%= format_time reply.created_on %>
@ -33,8 +33,9 @@
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %> <% end %>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:button_reply),'', <%#= link_to l(:button_reply),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
<%= link_to l(:button_reply),'javascript:;',{:nhname=>"reply_btn"} %>
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: --> <% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
</div> </div>
<div class="cl"></div> <div class="cl"></div>

@ -35,7 +35,7 @@
border: #d5dee9 1px solid; border: #d5dee9 1px solid;
} }
</style> </style>
<div style="width: 80%; margin-left:10%;"> <div style="width: 80%; margin-left:10%;" nhname='new_message'>
<%= form_for('new_form', :remote => true, :method => :post, <%= form_for('new_form', :remote => true, :method => :post,
:url => {:controller => 'words', :url => {:controller => 'words',
:action => 'create', :action => 'create',
@ -51,10 +51,13 @@
<%= f.text_area 'user_message', :rows => 3, :cols => 65, <%= f.text_area 'user_message', :rows => 3, :cols => 65,
:placeholder => "#{l(:label_leave_a_message)}", :placeholder => "#{l(:label_leave_a_message)}",
:style => "resize: none; width: 98%", :style => "resize: none; width: 98%",
:class => 'noline'%> :class => 'noline',:nhname=>'new_message_textarea'%>
<%# end %> <%# end %>
<%= f.text_field :reference_user_id, :style=>"display:none"%> <%= f.text_field :reference_user_id, :style=>"display:none"%>
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%> <p nhname="contentmsg"></p>
<div style="padding-top:5px;float:left;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-top: 5px;"%>
<a href="javascript:;" id="new_message_cancel_btn" style="display:none;"></a>
<%else %> <%else %>
<div style="font-size: 14px;margin:10px;"> <div style="font-size: 14px;margin:10px;">
<%= l(:label_user_login_tips) %> <%= l(:label_user_login_tips) %>

@ -1,15 +1,19 @@
<%= form_tag(words_create_reply_path, :remote => true) do %> <%= form_tag(words_create_reply_path, :remote => true) do %>
<%= text_area_tag 'user_notes', "", :class => 'noline', <%= text_area_tag 'user_notes', "", :class => 'noline',
:style => "resize: none;", :rows => 4, :style => "resize: none;", :rows => 4,
:placeholder => l(:label_feedback_respond_content), :placeholder => l(:label_feedback_respond_content)#,
:maxlength => 250 %> #:maxlength => 250
%>
<p nhname="contentmsg"></p>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %>
<div class="fl" style="padding-top:5px;float:left;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_feedback_respond), :name => nil , <%= submit_tag l(:button_feedback_respond), :name => nil ,
:class => "enterprise", :class => "enterprise",
:style => "float: right; margin-top: 1px; margin-right: 4px;margin-bottom: 5px;"%> :style => "float: right; margin-top: 1px; margin-right: 4px;margin-bottom: 5px;"%>
<input nhname="cancel_btn" type="button" style="display:none;"/>
<% end %> <% end %>

@ -1,15 +1,18 @@
<%= form_tag(words_create_reply_path, :remote => true) do %> <%= form_tag(words_create_reply_path, :remote => true) do %>
<%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5', <%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5',
:style => "resize: none;overflow: hidden;",:rows => 4, :style => "resize: none;overflow: hidden;",:rows => 4,
:placeholder => l(:label_feedback_respond_content), :placeholder => l(:label_feedback_respond_content)#,
:maxlength => 250 %> #:maxlength => 250
%>
<p nhname="contentmsg"></p>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_feedback_respond), :name => nil , <%= submit_tag l(:button_feedback_respond), :name => nil ,
:class => "reply_btn"%> :class => "reply_btn"%>
<input nhname="cancel_btn" type="button" style="display:none;"/>
<% end %> <% end %>

@ -1,15 +1,18 @@
<%= form_tag(words_create_reply_path, :remote => true) do %> <%= form_tag(words_create_reply_path, :remote => true) do %>
<%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5', <%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5',
:style => "resize: none;overflow: hidden;",:rows => 4, :style => "resize: none;overflow: hidden;",:rows => 4,
:placeholder => l(:label_feedback_respond_content), :placeholder => l(:label_feedback_respond_content)
#,:maxlength => 250
:maxlength => 250 %> %>
<p nhname="contentmsg"></p>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_feedback_respond), :name => nil , <%= submit_tag l(:button_feedback_respond), :name => nil ,
:class => "reply_btn"%> :class => "reply_btn"%>
<input nhname="cancel_btn" type="button" style="display:none;"/>
<% end %> <% end %>

@ -3,4 +3,7 @@ $('#history').html('<%= escape_javascript(render(:partial => 'users/history',:lo
$('#jour_count').html('<%= @obj_count%>') $('#jour_count').html('<%= @obj_count%>')
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val(""); $('#new_form_user_message').val("");
if($('#new_message_cancel_btn') != undefined && $('#new_message_cancel_btn').length!=0){
$('#new_message_cancel_btn').click();
}
$('#new_form_reference_user_id').val(""); $('#new_form_reference_user_id').val("");

@ -1,3 +0,0 @@
if Rails.env.production?
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes }
end

@ -67,6 +67,8 @@ module RedmineApp
# Do not include all helpers # Do not include all helpers
config.action_controller.include_all_helpers = false config.action_controller.include_all_helpers = false
config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed'
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
end end

@ -219,7 +219,7 @@ zh:
label_submit: 提交 label_submit: 提交
button_project_tags_add: 增加 button_project_tags_add: 增加
button_download: 下载 button_download: 下载
button_more: "更多»" button_more: "更多"
button_delete: 删除 button_delete: 删除
button_unfollow: 取消关注 button_unfollow: 取消关注
button_follow: 关注 button_follow: 关注

@ -20,4 +20,4 @@ zh:
mail_issue_sent_from: "来源:" mail_issue_sent_from: "来源:"
mail_issue_from_project: "项目问题跟踪" mail_issue_from_project: "项目问题跟踪"
mail_issue_attachments: "附件:" mail_issue_attachments: "附件:"
mail_issue_reply: "我要回复" mail_issue_reply: "我要回复"

@ -86,7 +86,7 @@ zh:
label_roadmap: 里程碑 #版本路线图 label_roadmap: 里程碑 #版本路线图
project_module_dts: DTS测试工具 project_module_dts: DTS测试工具
label_project_tool_response: 用户反馈 label_project_tool_response: 用户反馈
label_course_news: 项目新闻 label_project_news: 项目新闻
label_project_overview: "项目简介" label_project_overview: "项目简介"
label_expend_information: 展开更多信息 label_expend_information: 展开更多信息
@ -395,7 +395,8 @@ zh:
label_issue_score: issue得分 label_issue_score: issue得分
label_issue_number: issue的数量 label_issue_number: issue的数量
label_issue_journal_number: issue的留言数量 label_issue_journal_number: issue的留言数量
label_project_mail_feedback: 项目留言
label_news_score: 新闻得分 label_news_score: 新闻得分
label_new_number: 新闻的数量 label_new_number: 新闻的数量

@ -736,6 +736,7 @@ zh:
label_date_to: label_date_to:
label_language_based: 根据用户的语言 label_language_based: 根据用户的语言
label_mail_policy: 邮件策略
label_send_test_email: 发送测试邮件 label_send_test_email: 发送测试邮件
label_feeds_access_key: RSS存取键 label_feeds_access_key: RSS存取键
label_missing_feeds_access_key: 缺少RSS存取键 label_missing_feeds_access_key: 缺少RSS存取键
@ -782,6 +783,7 @@ zh:
label_project_newother: "查看其他评论" label_project_newother: "查看其他评论"
label_project_newshare: "分享了" label_project_newshare: "分享了"
label_project_notice: "发布了通知:" label_project_notice: "发布了通知:"
label_project_mail_notice: "发布了新闻:"
label_project_issue: "发布了问题:" label_project_issue: "发布了问题:"
label_project_newadd: "添加了" label_project_newadd: "添加了"
label_project_unadd: "暂无项目,赶快去创建吧!" label_project_unadd: "暂无项目,赶快去创建吧!"
@ -1504,6 +1506,7 @@ zh:
label_news_number: 新闻的数量 label_news_number: 新闻的数量
label_wiki_number: wiki的数量 label_wiki_number: wiki的数量
label_wiki_mail_notification: 发布了wiki
@ -1936,6 +1939,7 @@ zh:
label_poll_description: 问卷描述 label_poll_description: 问卷描述
label_poll_options: 选项 label_poll_options: 选项
label_poll_subtotal: 小计 label_poll_subtotal: 小计
label_poll_question_num: "第%{num}题"
label_poll_proportion: 比例 label_poll_proportion: 比例
label_poll_valid_commit: 本题有效填写人次 label_poll_valid_commit: 本题有效填写人次
label_poll_result: 问卷调查_问卷统计 label_poll_result: 问卷调查_问卷统计

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

Loading…
Cancel
Save