This commit is contained in:
Tim 2015-09-25 10:43:42 +08:00
commit c675a4c227
106 changed files with 4429 additions and 1820 deletions

View File

@ -101,8 +101,9 @@ class BoardsController < ApplicationController
@topic_count = @board ? @board.topics.count : 0
if @project
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
#现在发布帖子的时候置顶功能已经没有了。所以取消这个置顶排序 #{Message.table_name}.sticky DESC,
@topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
reorder("#{Message.table_name}.created_on desc").
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).

View File

@ -7,7 +7,7 @@ class ForumsController < ApplicationController
before_filter :find_forum_if_available
before_filter :authenticate_user_edit, :only => [:edit, :update]
before_filter :authenticate_user_destroy, :only => [:destroy]
before_filter :require_login, :only => [:new, :create]
before_filter :require_login, :only => [:new, :create,:destroy,:update,:edit]
helper :sort
include SortHelper
@ -97,7 +97,24 @@ class ForumsController < ApplicationController
def index
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.reorder("sticky DESC")
if(params[:reorder_complex])
@type="reorder_complex"
@str=params[:reorder_complex]
@forums_all = Forum.reorder("topic_count #{params[:reorder_complex]},updated_at #{params[:reorder_complex]}")
elsif(params[:reorder_popu])
@type="reorder_popu"
@str=params[:reorder_popu]
@forums_all = Forum.reorder("topic_count #{params[:reorder_popu]}")
elsif(params[:reorder_time])
@type="reorder_time"
@str=params[:reorder_time]
@forums_all = Forum.reorder("updated_at #{params[:reorder_time]}")
else
params[:reorder_complex] = "desc"
@type="reorder_complex"
@str=params[:reorder_complex]
@forums_all = Forum.reorder("topic_count desc,updated_at desc")
end
@forums_count = @forums_all.count
@forums_pages = Paginator.new @forums_count, @limit, params['page']
@ -106,6 +123,7 @@ class ForumsController < ApplicationController
#@forums = Forum.all
respond_to do |format|
format.html # index.html.erb
format.js
format.json { render json: @forums }
end
end
@ -113,11 +131,25 @@ class ForumsController < ApplicationController
# GET /forums/1
# GET /forums/1.json
def show
sort_init 'updated_at', 'desc'
sort_update 'created_at' => "#{Memo.table_name}.created_at",
'replies' => "#{Memo.table_name}.replies_count",
'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)"
# sort_init 'updated_at', 'desc'
# sort_update 'created_at' => "#{Memo.table_name}.created_at",
# 'replies' => "#{Memo.table_name}.replies_count",
# 'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)"
order = ""
@order_str = ""
if(params[:reorder_complex])
order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
@order_str = "reorder_complex="+params[:reorder_complex]
elsif(params[:reorder_popu])
order = "replies_count #{params[:reorder_popu]}"
@order_str = "reorder_popu="+params[:reorder_popu]
elsif(params[:reorder_time])
order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}"
@order_str = "reorder_time="+params[:reorder_time]
else
order = "last_replies_memos.created_at desc, #{Memo.table_name}.created_at desc"
@order_str = "reorder_complex=desc"
end
@memo = Memo.new(:forum => @forum)
@topic_count = @forum.topics.count
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@ -126,19 +158,15 @@ class ForumsController < ApplicationController
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
order(sort_clause).
reorder(order).
preload(:author, {:last_reply => :author}).
all
@memos
# @offset, @limit = api_offset_and_limit({:limit => 10})
# @forum = Forum.find(params[:id])
# @memos_all = @forum.topics
# @topic_count = @memos_all.count
# @topic_pages = Paginator.new @topic_count, @limit, params['page']
# @offset ||= @topic_pages.offset
# @memos = @memos_all.offset(@offset).limit(@limit).all
@my_topic_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is null").count
@my_replies_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is not null").count
@errors = params[:errors]
respond_to do |format|
format.js
format.html {
render :layout => 'base_forums'
}# show.html.erb
@ -172,20 +200,23 @@ class ForumsController < ApplicationController
# Author lizanle
# Description after save后需要进行资源记录的更新
# owner_type = 2 对应的是 forum
@save_flag=true
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM
end
#end
respond_to do |format|
format.js
format.html { redirect_to @forum, notice: l(:label_forum_create_succ) }
format.json { render json: @forum, status: :created, location: @forum }
end
else
@save_flag=false
respond_to do |format|
flash.now[:error] = "#{l :label_forum_create_fail}: #{@forum.errors.full_messages[0]}"
format.js
format.html { render action: "new" }
format.json { render json: @forum.errors, status: :unprocessable_entity }
end
@ -199,10 +230,12 @@ class ForumsController < ApplicationController
respond_to do |format|
if @forum.update_attributes(params[:forum])
format.js {render :text=> true}
format.html { redirect_to @forum, notice: l(:label_forum_update_succ) }
format.json { head :no_content }
else
flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}"
format.js { render :text=> false}
format.html { render action: "edit" }
format.json { render json: @forum.errors, status: :unprocessable_entity }
end
@ -261,6 +294,47 @@ class ForumsController < ApplicationController
end
end
#检查forum的名字
def check_forum_name
forum_name_exist = Forum.where("name = '#{params[:forum_name]}'").count >= 1 ? true : false
render :text => forum_name_exist
end
#添加论坛tag
def add_forum_tag
@forum = Forum.find(params[:id])
unless @forum.nil?
@forum.tag_list.add(params[:tag_str].split(','))
@forum.save
end
respond_to do |format|
format.js {render :delete_forum_tag}
end
end
#删除forum的tag
def delete_forum_tag
@tag_id = (ActsAsTaggableOn::Tag.find_by_name(params[:tag_name])).id
#forum的taggable_type = 5
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,params[:id],'Forum')
unless @taggings.nil?
@taggings.delete
end
# 是否还有其他记录 引用了 tag_id
@tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id)
# 如果taggings表中记录已经不存在 那么检查tags表 作删除动作
if @tagging.nil?
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
@tag.delete unless @tag.nil?
end
@forum = Forum.find(params[:id])
respond_to do |format|
format.js
end
end
private
def find_forum_if_available

View File

@ -5,9 +5,9 @@ class HomeworkCommonController < ApplicationController
layout "base_courses"
include StudentWorkHelper
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 :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr]
before_filter :member_of_course, :only => [:index]
def index
@ -23,116 +23,11 @@ class HomeworkCommonController < ApplicationController
#新建作业,在个人作业列表创建作业
def new
render_404
# @homework_type = "1"
#
# @homework = HomeworkCommon.new
# @homework.safe_attributes = params[:homework_common]
# @homework.late_penalty = 2
# @homework.end_time = (Time.now + 3600 * 24).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.absence_penalty = 2
# @homework_detail_manual.evaluation_num = 3
# @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
# @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @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|
# format.html
# end
end
#新建作业,在个人作业列表创建作业
def create
redirect_to user_homeworks_user_path(User.current.id)
# if params[:homework_common]
# homework = HomeworkCommon.new
# homework.name = params[:homework_common][:name]
# homework.description = params[:homework_common][:description]
# homework.end_time = params[:homework_common][:end_time]
# homework.publish_time = params[:homework_common][:publish_time]
# homework.homework_type = params[:homework_common][:homework_type]
# homework.late_penalty = params[:late_penalty]
# homework.user_id = User.current.id
# homework.course_id = @course.id
#
# homework.save_attachments(params[:attachments])
# render_attachment_warning_if_needed(homework)
#
# if homework.homework_type == 2
# homework_detail_programing = HomeworkDetailPrograming.new
# homework_detail_programing.language = params[:language]
# homework_detail_programing.standard_code = params[:standard_code]
# homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
# question = {title:homework.name,content:homework.description}
# question[:input] = []
# question[:output] = []
# if params[:input] && params[:output] && params[:result]
# params[:input].each do |k,v|
# if params[:output].include? k
# homework_test = HomeworkTest.new
# homework_test.input = v
# homework_test.output = params[:output][k]
# homework_test.result = params[:result][k]
# homework_test.error_msg = params[:error_msg]
# homework.homework_tests << homework_test
# question[:input] << homework_test.input
# question[:output] << homework_test.output
# end
# end
# end
#
# # uri = URI('http://192.168.80.21:8080/api/questions.json')
# # body = question.to_json
# # res = Net::HTTP.new(uri.host, uri.port).start do |client|
# # request = Net::HTTP::Post.new(uri.path)
# # request.body = body
# # request["Content-Type"] = "application/json"
# # client.request(request)
# # end
# # result = JSON.parse(res.body)
# # homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
#
# 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
# homework_detail_programing.save if homework_detail_programing
# homework_detail_manual.save if homework_detail_manual
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_successful_create)
# redirect_to homework_common_index_path(:course => @course.id)
# }
# end
# return
# end
# end
#
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_failed_create)
# redirect_to new_homework_common_path(:course => @course.id)
# }
# end
end
def edit
@ -294,6 +189,27 @@ class HomeworkCommonController < ApplicationController
end
end
#启动匿评参数设置
def start_evaluation_set
end
#设置匿评参数
def set_evaluation_attr
if @homework_detail_manual
unless params[:evaluation_start].to_s == @homework_detail_manual.evaluation_start.to_s
@homework_detail_manual.evaluation_start = params[:evaluation_start]
end
unless @homework_detail_manual.evaluation_end.to_s == params[:evaluation_end].to_s
@homework_detail_manual.evaluation_end = params[:evaluation_end]
end
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.save
end
end
private
#获取课程
def find_course

View File

@ -223,7 +223,6 @@ class IssuesController < ApplicationController
end
if saved
#修改界面增加跟踪者
watcherlist = @issue.watcher_users
select_users = []
@ -253,9 +252,7 @@ class IssuesController < ApplicationController
JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id)
end
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
respond_to do |format|
format.html { redirect_to issue_url(@issue.id) }
format.api { render_api_ok }
end

View File

@ -36,8 +36,7 @@ class JournalsController < ApplicationController
sort_update(@query.sortable_columns)
if @query.valid?
@journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC",
:limit => 25)
@journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", :limit => 25)
end
@title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name)
render :layout => false, :content_type => 'application/atom+xml'
@ -72,9 +71,9 @@ class JournalsController < ApplicationController
end
# Replaces pre blocks with [...]
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
# @content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
@content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n"
@content << text.gsub(/(\r?\n|\r\n?)/, "\n ") + "\n"
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content << "</blockquote>"
@id = user.id
rescue ActiveRecord::RecordNotFound
render_404

View File

@ -11,7 +11,7 @@ class MemosController < ApplicationController
include AttachmentsHelper
include ApplicationHelper
layout 'base_memos'
# layout 'base_memos'
def quote
@subject = @memo.subject
@ -73,41 +73,14 @@ class MemosController < ApplicationController
end
end
#end
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
format.json { render json: @memo, status: :created, location: @memo }
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
format.json { render json: @memo, status: :created, location: @memo }
else
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
pre_count = REPLIES_PER_PAGE
@memo_new = @memo.dup
@memo = @memo.root # 取出楼主防止输入帖子id让回复作为主贴显示
unless @memo.new_record?
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
end
page = params[:page]
if params[:r] && page.nil?
offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
page = 1 + offset / pre_count
else
end
@reply_count = @memo.children.count
@reply_pages = Paginator.new @reply_count, pre_count, page
@replies = @memo.children.
includes(:author, :attachments).
reorder("#{Memo.table_name}.created_at DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all
if @memo.new_record?
format.html { render :new,:layout=>'base'}
else
format.html { render action: :show }
format.js
format.html { redirect_to( forum_path(Forum.find(params[:forum_id]),:errors=>@memo.errors.full_messages[0])) }
format.json { render json: @memo.errors, status: :unprocessable_entity }
end
#end
end
end
@ -115,6 +88,7 @@ class MemosController < ApplicationController
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
def show
# 更新贴吧帖子留言对应的memo_messages的viewed字段
unless @memo.children.blank?
@memo.children.each do |child|
@ -154,21 +128,27 @@ class MemosController < ApplicationController
@memo_new = Memo.new
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
# @memo = Memo.find_by_id(params[:id])
# @forum = Forum.find(params[:forum_id])
# @replies = @memo.replies
# @mome_new = Memo.new
respond_to do |format|
format.html # show.html.erb
format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums',
format.json { render json: @memo }
format.xml { render xml: @memo }
end
end
def edit
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
@replying = false
respond_to do |format|
format.html {render :layout=>'base_forums'}
end
end
def update
@ -176,7 +156,8 @@ class MemosController < ApplicationController
if( #@memo.update_column(:subject, params[:memo][:subject]) &&
@memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky]) &&
@memo.update_column(:lock, params[:memo][:lock]))
@memo.update_column(:lock, params[:memo][:lock]) &&
@memo.update_column(:subject,params[:memo][:subject]))
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
@memo.save
# @memo.root.update_attribute(:updated_at, @memo.updated_at)
@ -227,7 +208,7 @@ class MemosController < ApplicationController
end
def back_memo_url
forum_memo_path(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))
forum_memo_path(@forum, (@memo.root.nil? ? @memo : @memo.root))
end
def back_memo_or_forum_url

View File

@ -160,6 +160,7 @@ class MessagesController < ApplicationController
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
# @reply.reply_id = params[:id]
@topic.children << @reply
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
user_activity.updated_at = Time.now

View File

@ -162,7 +162,7 @@ class ProjectsController < ApplicationController
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
render :layout => 'new_base'
else
redirect_to signin_url
end
@ -188,7 +188,8 @@ class ProjectsController < ApplicationController
@project.safe_attributes = params[:project]
@project.organization_id = params[:organization_id]
@project.user_id = User.current.id
@project.project_new_type = 1
@project.project_new_type = params[:project_new_type]
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
if validate_parent_id && @project.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
# Add current user as a project member if he is not admin
@ -220,7 +221,7 @@ class ProjectsController < ApplicationController
end
else
respond_to do |format|
format.html { render :action => 'new', :layout => 'base'}#Added by young
format.html { render :action => 'new', :layout => 'new_base'}#Added by young
format.api { render_validation_errors(@project) }
end
end

View File

@ -15,6 +15,7 @@ class TagsController < ApplicationController
include ContestsHelper
include ActsAsTaggableOn::TagsHelper
include TagsHelper
include FilesHelper
helper :projects
helper :courses
helper :tags
@ -236,47 +237,91 @@ class TagsController < ApplicationController
@rename_tag_name = params[:renameName]
@taggable_id = params[:taggableId]
@taggable_type = numbers_to_object_type(params[:taggableType])
@course_id = params[:courseId]
@rename_tag = (ActsAsTaggableOn::Tag.find_by_name(@rename_tag_name)) #查找重命名后的tag
@tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id #重命名前的tag_id
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type)
@obj = get_object(@taggable_id,params[:taggableType])
if(@rename_tag.nil?) #这次命名的是新的tag
# 是否还有其他记录 引用了 tag_id
@tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}")
# 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字
if @tagging.count == 1
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
@tag.update_attributes({:name=>@rename_tag_name})
else #如果tagging表中的记录大于1那么就要新增tag记录
unless @obj.nil?
@obj.tag_list.add(@rename_tag_name.split(","))
@obj.save
end
#删除原来的对应的taggings的记录
unless @taggings.nil?
@taggings.delete
end
end
else #这是已有的tag
# 更改taggings记录里的tag_id
unless @taggings.nil?
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) unless @taggable_id.blank?
@obj = get_object(@taggable_id,params[:taggableType]) unless @taggable_id.blank?
if @taggable_id.blank? #如果没有传tag_id那么直接更新tag_name就好了。但是要防止 重命名后的tag存在。
#看重命名后的tag是否存在。如果存在的话只需要更改taggings里边的id即可
if @rename_tag
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type)
@taggings.update_attributes({:tag_id=>@rename_tag.id})
else #如果不存在那么就直接更新该tag名称为新的名称
(ActsAsTaggableOn::Tag.find_by_name(@tag_name)).update_attributes(:name=>@rename_tag_name)
end
else
if(@rename_tag.nil?) #这次命名的是新的tag
# 是否还有其他记录 引用了 tag_id
@tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}")
# 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字
if @tagging.count == 1
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
@tag.update_attributes({:name=>@rename_tag_name})
else #如果tagging表中的记录大于1那么就要新增tag记录
unless @obj.nil?
@obj.tag_list.add(@rename_tag_name.split(","))
@obj.save
end
#删除原来的对应的taggings的记录
unless @taggings.nil?
@taggings.delete
end
end
else #这是已有的tag
# 更改taggings记录里的tag_id
unless @taggings.nil?
@taggings.update_attributes({:tag_id=>@rename_tag.id})
end
end
end
@obj_flag = params[:taggableType]
if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course)
@course = @obj.container
@tag_list = @tag_list = get_course_tag_list @course
elsif @course_id
@course = Course.find(@course_id)
@tag_list = get_course_tag_list @course
#这里要引用FilesController里的逻辑了。将资源库当前的文件列表刷新一遍。
@flag = params[:flag] || false
sort = ""
@sort = ""
@order = ""
@is_remote = false
@isproject = false
sort = "#{Attachment.table_name}.created_on desc"
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
elsif @obj && @obj_flag == '5'
@forum = @obj
end
respond_to do |format|
format.js
end
end
def show_attachments obj
@attachments = []
obj.each do |container|
@attachments += container.attachments
end
@all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments)
@limit = 10
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@obj_attachments = paginateHelper @all_attachments,10
end
def tag_save
@select_tag_name = params[:tag_for_save][:tag_name]
@tags = params[:tag_for_save][:name]

View File

@ -101,33 +101,12 @@ class UsersController < ApplicationController
elsif @user != User.current && !User.current.admin?
return render_403
end
# 记录当前点击按钮的时间
# 考虑到用户未退出刷新消息页面
message_time = OnclickTime.where("user_id =?", User.current).first
if message_time.nil?
message_new_time = OnclickTime.new
message_new_time.user_id = User.current.id
message_new_time.onclick_time = Time.now
message_new_time.save
else
# 24小时内显示
contrast_time = Time.now - 86400
message_time.update_attributes(:onclick_time => Time.now)
end
@user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc")
# 当前用户查看消息,则设置消息为已读
# DO 待优化,只需查出符合条件的再更新
# 初始化/更新 点击按钮时间
# 24小时内显示系统消息
update_onclick_time
# 全部设为已读
if params[:viewed] == "all"
course_querys = @user.course_messages
forge_querys = @user.forge_messages
user_querys = @user.user_feedback_messages
forum_querys = @user.memo_messages
if User.current.id == @user.id
course_querys.update_all(:viewed => true)
forge_querys.update_all(:viewed => true)
user_querys.update_all(:viewed => true)
forum_querys.update_all(:viewed => true)
end
update_message_viewed(@user)
end
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
case params[:type]
@ -197,6 +176,39 @@ class UsersController < ApplicationController
end
end
# 初始化/更新 点击按钮时间
def update_onclick_time
# 记录当前点击按钮的时间
# 考虑到用户未退出刷新消息页面
message_time = OnclickTime.where("user_id =?", User.current).first
if message_time.nil?
message_new_time = OnclickTime.new
message_new_time.user_id = User.current.id
message_new_time.onclick_time = Time.now
message_new_time.save
else
# 24小时内显示
contrast_time = Time.now - 86400
message_time.update_attributes(:onclick_time => Time.now)
end
# 24小时内显示系统消息
@user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc")
end
# 消息设置为已读
def update_message_viewed(user)
course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0)
forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
if User.current.id == @user.id
course_querys.update_all(:viewed => true)
forge_querys.update_all(:viewed => true)
user_querys.update_all(:viewed => true)
forum_querys.update_all(:viewed => true)
end
end
# 系统消息
def user_system_messages
@sytem_messages = SystemMessage.order("created_at desc").all

View File

@ -2306,7 +2306,7 @@ module ApplicationHelper
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
when 3
link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
else
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评"
@ -2356,8 +2356,8 @@ module ApplicationHelper
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品已交", "", :class => 'c_blue', :title => "开启匿评后不可修改作品"
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品已交", "javascript:void(0)", :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else

View File

@ -76,6 +76,36 @@ module ProjectsHelper
return result
end
# 项目类型
def project_type_select
type = []
option1 = []
option1 << l(:label_development_team)
option1 << l(:label_development_team)
option2 = []
option2 << l(:label_research_group)
option2 << l(:label_research_group)
option3 = []
option3 << l(:label_friend_organization)
option3 << l(:label_friend_organization)
type << option1
type << option2
type << option3
type
end
# 项目类型描述
def project_newtype_descrption
case params
when 1
value = l(:label_type_des_development)
when 2
value = l(:label_type_des_research)
when 3
value = l(:label_type_des_friend)
end
end
# 被邀请成员的状态
def status_for_ivitied(ivite_list, project)
if ivite_list.user.member_of?(project)

View File

@ -1,5 +1,6 @@
module TagsHelper
include StoresHelper
include CoursesHelper
# 通过 id和type获取对象
def get_object(obj_id,obj_type)
@obj = nil
@ -62,6 +63,27 @@ module TagsHelper
end
#判断课程course中是否包含课件attachmentcourse中引用了attachment也算作包含
def course_contains_attachment? course,attachment
course.attachments.each do |att|
if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from
return true
end
end
false
end
#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
def has_course? user,file
result = false
user.courses.each do |course|
if !course_contains_attachment?(course,file) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
return true
end
end
result
end
# 判断用户是否是贴吧的管理员
# add by chenmin
def is_forum_manager?(user_id,forum_id)

View File

@ -463,7 +463,7 @@ module UsersHelper
def get_issue_des_update(journal)
no_html = "message"
arr = details_to_strings(journal.details, no_html)
unless journal.notes.empty?
unless journal.notes.blank?
arr << "留言内容:" + journal.notes
end
str = ''

View File

@ -14,7 +14,7 @@ class Forum < ActiveRecord::Base
'sticky',
'locked'
validates_presence_of :name, :creator_id, :description
validates_length_of :name, maximum: 50
validates_length_of :name, maximum: 160
#validates_length_of :description, maximum: 255
validates :name, :uniqueness => true
after_destroy :delete_kindeditor_assets

View File

@ -4,6 +4,6 @@ class HomeworkDetailPrograming < ActiveRecord::Base
belongs_to :homework_common
def language_name
%W(C C++ Python).at(self.language.to_i - 1)
%W(C C++ Python Java).at(self.language.to_i - 1)
end
end

View File

@ -171,11 +171,16 @@ class Journal < ActiveRecord::Base
# 缺陷状态更改,消息提醒
def act_as_forge_message
receivers = []
# 直接回复
if self.user_id != self.issue.author_id
self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, :project_id => self.issue.project_id, :viewed => false)
receivers << self.issue.author_id
end
if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送
self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false)
receivers << self.issue.assigned_to_id
end
receivers.each do |r|
self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false)
end
end

View File

@ -5,8 +5,34 @@ class JournalReply < ActiveRecord::Base
belongs_to :user
belongs_to :journal
after_create :send_journal_messages
def self.add_reply(journal_id, reply_id, user_id)
self.create(:journal_id => journal_id, :reply_id => reply_id, :user_id => user_id)
end
def send_journal_messages
journal = self.journal
replier = User.find(self.reply_id)
receivers = []
# 被回复的人发送消息
if journal.user_id != self.reply_id && self.reply_id != journal.issue.author_id
receivers << replier
end
if journal.user_id != journal.issue.author_id && self.reply_id != journal.issue.author_id
receivers << self.journal.issue.author
end
# journal_forge_messages = ForgeMessage.new
receivers.each do |r|
journal.forge_messages << ForgeMessage.new(:user_id =>r.id, :project_id => journal.issue.project_id, :viewed => false)
end
# if self.user_id != self.journal_reply.user_id
# receivers << self.journal_reply.user_id
# end
# # 给缺陷发布者发送
# if self.user_id != self.issue.author_id && self.journal_reply.user_id != self.issue.author_id
# receivers << self.issue.author_id
# end
end
end

View File

@ -86,7 +86,7 @@ class Message < ActiveRecord::Base
}
safe_attributes 'subject', 'content'
safe_attributes 'subject', 'content', 'reply_id'
safe_attributes 'board_id','locked', 'sticky',
:if => lambda {|message, user|
if message.project

View File

@ -264,6 +264,7 @@ class User < Principal
if OnclickTime.where("user_id =?", User.current).first.nil?
message_new_time = OnclickTime.new
message_new_time.user_id = User.current.id
# 第一次初始化点击铃铛时间
message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on
message_new_time.save
end

View File

@ -51,9 +51,9 @@
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
<%# if topic.sticky? %>
<!--<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%#= l(:label_board_sticky)%></a>-->
<%# end %>
<script>
//$(function(){if($("#contentmessage<%#=topic.id %>").height()>182){$("#project_show_<%#= topic.id%>").show();}});
//解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug

View File

@ -3,13 +3,13 @@
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% end %>
</p>
</div>

View File

@ -3,7 +3,7 @@
<% if tag_name && tag_name == k%>
<a href="javascript:void(0);" class="files_tag_select"><%= k%>×<%= v%></a>
<% else%>
<a href="javascript:void(0);" class="files_tag_icon" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(course)%>','<%= k%>','<%= @q%>','<%= course.id%>');"><%= k%>×<%= v%></a>
<a href="javascript:void(0);" class="files_tag_icon" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>×<%= v%></a>
<% end%>
<% end%>
<% end%>

View File

@ -223,12 +223,16 @@
});
}
<% if @course %>
var tagNameHtml; //当前双击的链接的父节点的html
var tagName; //标签的值
var parentCssBorder; //当前双击的链接的父节点
var ele; //当前双击的链接
var tagId; //标签的id
var taggableType; //被标签的类型
//这里renameTag有两种情况一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id就是第一种情况。如果没有id。就是第二种情况
function rename_tag(domEle,name,id,type){
if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动
return;
@ -239,7 +243,8 @@
ele = domEle;
tagId = id;
taggableType = type;
domEle.html('<input name="" id="renameTagName" style="width: 100px;" value="'+name+'"/>');
width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width +'px;" value="'+name+'"/>');
domEle.parent().css("border","1px solid #ffffff");
$("#renameTagName").focus();
}
@ -256,14 +261,10 @@
}else{ //否则就要更新tag名称了
if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){
$.post(
'<%= update_tag_name_path %>',
{"taggableId":tagId,"taggableType":taggableType,"tagName":tagName,"renameName":$("#renameTagName").val().trim()}
// function(data){
// ele.parent().css("border","");
// ele.parent().html(tagNameHtml);
// }
)
$.post(
'<%= update_tag_name_path %>',
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>}
)
}else{
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
@ -271,6 +272,7 @@
}
}
});
<%end %>
</script>

View File

@ -0,0 +1,79 @@
<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">
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<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}][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') %>
<%= if attachment.id.nil?
#待补充代码
else
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
end
%>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<div class="cl"></div>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<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}][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') %>
<%= if attachment.id.nil?
#待补充代码
else
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
end
%>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<div class="cl"></div>
<% end %>
<% end %>
</span>
<% project = project %>
<div class="cl"></div>
<!--<span class="add_attachment" style="font-weight:normal;">-->
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %>
<a href="javascript:void(0);" onclick="$('#_file').click();" class="AnnexBtn fl mr15">上传附件</a>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => ie8? ? '' : 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js', :project => project),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<!--<span id="upload_file_count">-->
<!--<%#= l(:label_no_file_uploaded) %>-->
<!--</span>-->
<!--(<%#= l(:label_max_size) %>:-->
<%#= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>
<!--)-->
<!--</span>-->
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>

View File

@ -1,49 +1,26 @@
<!-- added by fq -->
<!-- %= form_for(@forum) do |f| % -->
<div id="share_new" style = "width: 500px; margin:0 auto; " >
<%= labelled_form_for(@forum) do |f| %>
<% if @forum.errors.any? %>
<!--<div id="error_explanation">
<h2><#%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:</h2>
<div class="homepageContentContainer mb10">
<div class="homepageContent">
<div class="pageBanner mt15"><div class="NewsBannerName">编辑贴吧</div></div>
<div class="cl"></div>
<ul>
<#% @forum.errors.full_messages.each do |msg| %>
<li><#%= msg %></li>
<#% end %>
</ul>
</div> -->
<% end %>
<div style="width: 120%;">
<div class="field">
<%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%>
</div>
<div>
<% if User.current.logged? && User.current.admin? %>
<% if @forum.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<% if @forum.safe_attribute? 'locked' %>
<%= f.check_box :locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<div class="postContainer">
<%= labelled_form_for(@forum) do |f| %>
<div id="error" style="display: none;color: red;">
</div>
<div>
<textarea type="text" id="forum_name" name="forum[name]" class="postCreateInput" placeholder="对应贴吧名称" ><%= @forum.name.html_safe%></textarea>
</div>
<div class="mt15">
<textarea type="text" id="forum_desc" name="forum[description]" class="postCreateInput" placeholder="对应贴吧描述" ><%= @forum.description.html_safe%></textarea>
</div>
<div class="mt10">
<div class="fr"><a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit($(this));">确定</a></div>
<div class="fr"><a href="<%= forum_path(@forum)%>" class="linkGrey2 mr10" >取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div>
<p style="max-width:680px">
<%= f.kindeditor :description, :required => true,:owner_id => @forum.id,:owner_type => 2 %>
</p>
<!-- <script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
<p style="color: #ff0000">
(<%= l(:label_forums_max_length) %>)
</p>
</div>
<div class="actions" style=" padding-top: 10px; float:right">
<%= submit_tag l(:button_submit) %>
<%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %>
</div>
</div>
<% end %>
</div>

View File

@ -0,0 +1,15 @@
<div><img src="images/post_portrait.jpg" width="75" height="75" alt="贴吧图片" id="forum_image" class="mr10 fl" />
<a href="javascript:void(0)" class="upImg linkGrey2 fl" onclick="open_upload_diaglog();">上传图片</a>
<div class="cl"></div>
</div>
<div class="mt15">
<input type="text" name="postName" class="postCreateInput" placeholder="输入贴吧名称" />
</div>
<div class="mt15">
<input type="text" name="postName" class="postCreateInput" placeholder="输入贴吧描述" />
</div>
<div class="mt10">
<div class="fr"><a href="javascript:void(0);" class="submit_btn">确定</a></div>
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>

View File

@ -1,57 +1,38 @@
<!-- added by fq -->
<div class="forums-list">
<% if forums.any? %>
<% forums.each do |forum| %>
<div class="forums-index">
<div class="forums-inex-avatar">
<%= forum.creator.nil? ? (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar")) : (link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator)) %>
</div>
<div class="forums-index-content">
<table class="content-text-list" style="table-layout: fixed;">
<tr>
<td valign="top" width="500px" class=" <%= forum.sticky? ? 'sticky' : '' %><%= forum.locked? ? 'locked' : '' %>" style="word-break: break-all;word-wrap: break-word;">
<p >
<%= link_to h(forum.name), forum_path(forum) %>
</p>
</td>
</tr>
<tr>
<td style="word-break: break-all;word-wrap: break-word;" class="upload_img">
<p>
<%= textAreailizable forum.description%>
</p>
</td>
</tr>
<tr>
<td style="word-break: break-all;word-wrap: break-word;">
<p >
<%= authoring forum.created_at, forum.creator %>
</p>
</td>
</tr>
</table>
</div>
<div class="forums-index-count">
<table class="forums-count-color">
<tr class="forums-count-color" align="center">
<td>
<%= link_to (forum.memo_count), forum_path(forum) %>
</td>
<td>
<%= link_to (forum.topic_count), forum_path(forum) %>
</td>
</tr>
<tr align="center">
<td>回答</td>
<td>帖子</td>
</tr>
</table>
</div>
</div>
<div class="postRow">
<div class="postPortrait"><a href="javascript:void(0);" class="linkGrey2">
<%= link_to image_tag(url_to_avatar(forum.creator),:width=>75,:height => 75 ),user_path( forum.creator) %>
</div>
<div class="postWrap">
<div class="postTitle">
<!--<a href="javascript:void(0);" class="f16 linkBlue">新手讨论吧</a>-->
<%= link_to forum.name, forum_path(forum),:class=>"f16 linkBlue" %>
</div>
<div class="postDes"><%= textAreailizable forum.description%></div>
<div class="postCreater">创建者:<a href="<%= user_path( forum.creator)%>" class="linkGrey2" target="_blank"><%= forum.creator.name %></a></div>
<div class="postDate">创建时间:<%= format_date(forum.created_at) %></div>
</div>
<div class="postStatics">
<div>
<!--<a href="javascript:void(0);" class="linkGrey5 fb">280</a>-->
<%= link_to ( forum.topic_count), forum_path(forum),:class=>"linkGrey5 fb" %>
</div>
<div>帖子</div>
</div>
<div class="slice"></div>
<div class="postStatics mr20">
<div>
<!--<a href="javascript:void(0);" class="linkGrey5 fb">335</a>-->
<%= link_to (forum.memo_count), forum_path(forum),:class=>"linkGrey5 fb" %>
</div>
<div>回答</div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="pagination" style="margin-top: 10px;">
<%= pagination_links_full @forums_pages, @forums_count %>
</div>
<% else %>
<%= render :partial => "layouts/no_content" %>
<% end %>
</div>

View File

@ -0,0 +1,8 @@
<% forum.tag_list.each do |tag|%>
<span class="postlabel mr10">
<a href="javascript:void(0);" ondblclick="rename_tag($(this),<%= tag %>,<%= forum.id%>,5);" class="fontGrey2 mr5"><%= tag %></a>
<%if forum.creator.id == User.current.id%>
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
<% end %>
</span>
<% end %>

View File

@ -0,0 +1,33 @@
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a>
<% if order_type=='reorder_complex' && order_str == 'desc' %>
<a href="javascript:void(0);" id="reorder_complex" class="sortArrowActiveD"></a>
<% elsif order_type=='reorder_complex' && order_str == 'asc' %>
<a href="javascript:void(0);" id="reorder_complex" class="sortArrowActiveU"></a>
<% else %>
<a href="javascript:void(0);" id="reorder_complex" ></a>
<% end %>
</div>
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a>
<% if order_type=='reorder_popu' && order_str == 'desc' %>
<a href="javascript:void(0);" id="reorder_popu" class="sortArrowActiveD"></a>
<% elsif order_type=='reorder_popu' && order_str == 'asc' %>
<a href="javascript:void(0);" id="reorder_popu" class="sortArrowActiveU"></a>
<% else %>
<a href="javascript:void(0);" id="reorder_popu" ></a>
<% end %>
</div>
<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a>
<% if order_type=='reorder_time' && order_str == 'desc' %>
<a href="javascript:void(0);" id="reorder_time" class="sortArrowActiveD"></a>
<% elsif order_type=='reorder_time' && order_str == 'asc' %>
<a href="javascript:void(0);" id="reorder_time" class="sortArrowActiveU"></a>
<% else %>
<a href="javascript:void(0);" id="reorder_time" ></a>
<% end %>
</div>
<div class="creatPost">
<a href="javascript:void(0);" id="create_btn" class="c_white db creatPostIcon bBlue"
onclick="$('#error').hide();clear_form();$('#new_forum_div').slideToggle();$(this).parent().slideToggle();">新建贴吧</a></div>
<div class="cl"></div>

View File

@ -1,47 +1,31 @@
<script>$(function(){$("img").removeAttr("alt");});</script>
<div class="borad-topic-count">共有 <%=link_to @forum.memos.count %> 个贴子</div>
<div style="padding-top: 10px">
<% if memos.any? %>
<% memos.each do |topic| %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" style="width: 50px;">
<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%>
</td>
<td>
<table width="630px" border="0">
<tr>
<td valign="top" width="500px" class="<%= topic.sticky ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %></td>
<td align="right" rowspan="3">
<table class="borad-count">
<tr>
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %></td>
</tr>
<tr>
<td align="center">回答</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" ><span class="font_description"> </span></td>
</tr>
<tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
<span class="font_description2">
<% author = topic.last_reply.try(:author)%>
<% if author%>
最后回复:<%=link_to_user author %>
<% end%>
</span>
<br />
</span></td>
</tr>
</table>
</td>
</tr>
</table>
<div class="postDetailRow">
<div class="postDetailPortrait">
<!--<img src="images/homepageImage.jpg" width="50" height="50" alt="贴吧图片" /></a>-->
<%= link_to image_tag(url_to_avatar(topic.author), :width => 50,:height => 50,:alt => '贴吧图片'), user_path(topic.author) if topic.author%>
</div>
<div class="postDetailWrap">
<div class="postDetailTitle"><a href="<%= forum_memo_path(topic.forum, topic) %>" class="f14 linkGrey4 fb"><%=topic.subject%></a></div>
<div class="postDetailDes"><%= topic.content.html_safe%>
<!--<a href="javascript:void(0);" class="linkBlue2 underline ml8">显示全部</a>-->
</div>
<% author = topic.last_reply.try(:author)%>
<% if author%>
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.name%></a></div>
<div class="postDetailDate"><%= format_date(topic.last_reply.created_at)%></div>
<% end%>
</div>
<div class="postDetailReply">
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>

View File

@ -0,0 +1,6 @@
<%if @save_flag%>
$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
$('#reorder_time').click();
<%else%>
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
<%end %>

View File

@ -0,0 +1,2 @@
$("#forum_tag_list").html("<%= escape_javascript( render :partial=>'forum_tag_list',:locals=>{:forum=>@forum}) %>");
$('#add_tag01').hide();

View File

@ -1,4 +1,72 @@
<!-- added by fq -->
<h1>编辑讨论区</h1>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'new_user' %>
<script>
$(function(){
document.getElementById('forum_name').onkeydown = function()
{
var n = 0;
var str = this.value;
for (i = 0; i < str.length; i++) {
var leg = str.charCodeAt(i);//ASCII码
if (leg > 255) {
n += 2;
} else {
n += 1;
}
}
if(n >= 160)
event.returnValue = false;
}
})
function check_and_submit(doc){
$("#error").html('').hide();
check_forum_name();
if(check_pass == false){
return;
}
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
$("#error").html("名称不能为空").show();
return;
} else if( $("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() != "" ){
$("#error").html("描述不能为空").show();
return;
}else if($("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() == ""){
$("#error").html("名称和描述不能为空").show();
return;
}
else{
doc.parent().parent().parent().submit();
}
}
var check_pass = true;
function check_forum_name(){
check_pass = true;
name = $("textarea[name='forum[name]']").val().trim();
if(name == '<%= @forum.name%>'){
return;
}
if( name != ""){
$.get(
'<%= check_forum_name_forums_path %>',
{"forum_name":name},
function(data){
if( data == 'true'){
$("#error").html("贴吧名称已经存在").show();
check_pass = false;
}
}
);
}else{
check_pass = false;
}
}
</script>
<%= render 'form_edit_mode' %>
<script>
var textarea = document.getElementById('forum_name');
autoTextarea(textarea);
var textarea1 = document.getElementById('forum_desc');
autoTextarea(textarea1);
</script>

View File

@ -1,48 +1,170 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<!-- added by fq -->
<div class="top-content">
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf">公共贴吧 </td>
<td class="location-list">
<strong>
<%= l(:label_user_location) %> :
</strong>
</td>
<td rowspan="2">
<% if User.current.logged? %>
<%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %>
<% end %>
</td>
<td rowspan="2" width="250px" >
<div class="top-content-search">
<%#= form_tag(:controller => 'forums', :action => "search_forum", :method => :get) do %>
<%#= text_field_tag 'name', params[:name], :size => 20 %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%# end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px">
<a>
<%= link_to request.host()+"/forums", forums_path %>
</a>
</td>
<td >
<%= link_to l(:field_homepage), home_path %> >
<%= link_to "公共贴吧", forums_path %>
</td>
</tr>
</table>
</div>
<% if @forums.size > 0 %>
<%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %>
<% else %>
<%= render :partial => "layouts/no_content" %>
<% end %>
<%= javascript_include_tag 'new_user' %>
<%= stylesheet_link_tag 'public'%>
<script>
function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){
$("#"+id).removeClass("sortArrowActiveD");
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @forums_pages.page%>
<%html_title l(:label_forum)%>
});
}else if($("#"+id).hasClass("sortArrowActiveU")){
$("#"+id).removeClass("sortArrowActiveU");
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
});
}
}
$(function() {
$("#complex").click(function(){
$("#reorder_popu").removeClass("sortArrowActiveU");
$("#reorder_popu").removeClass("sortArrowActiveD");
$("#reorder_time").removeClass("sortArrowActiveD");
$("#reorder_time").removeClass("sortArrowActiveU");
add_class("reorder_complex");
});
$("#popu").click(function () {
$("#reorder_complex").removeClass("sortArrowActiveD");
$("#reorder_complex").removeClass("sortArrowActiveU");
$("#reorder_time").removeClass("sortArrowActiveD");
$("#reorder_time").removeClass("sortArrowActiveU");
add_class("reorder_popu");
});
$("#time").click(function () {
$("#reorder_complex").removeClass("sortArrowActiveD");
$("#reorder_complex").removeClass("sortArrowActiveU");
$("#reorder_popu").removeClass("sortArrowActiveU");
$("#reorder_popu").removeClass("sortArrowActiveD");
add_class("reorder_time");
});
document.getElementById('forum_name').onkeydown = function()
{
var n = 0;
var str = this.value;
for (i = 0; i < str.length; i++) {
var leg = str.charCodeAt(i);//ASCII码
if (leg > 255) {//大于255的都是中文
n += 2;//如果是中文就是2个字节
} else {
n += 1;//英文,不多说了
}
}
if(n >= 160 && event.keyCode != 8)
event.returnValue = false;
}
});
function check_and_submit(doc){
$("#error").html('').hide();
check_forum_name();
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
$("#error").html("名称不能为空").show();
return;
} else if( $("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() != "" ){
$("#error").html("描述不能为空").show();
return;
}else if($("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() == ""){
$("#error").html("名称和描述不能为空").show();
return;
}
else{
doc.parent().parent().submit();
}
}
var check_pass = true;
function check_forum_name(){
check_pass = true;
name = $("textarea[name='forum[name]']").val().trim();
if( name != ""){
$.get(
'<%= check_forum_name_forums_path %>',
{"forum_name":name},
function(data){
if( data == 'true'){
$("#error").html("贴吧名称已经存在").show();
check_pass = false;
}
}
);
}else{
check_pass = false;
}
if(check_pass == false){
return ;
}
}
function hideError(){
$("#error").html("").hide();
}
function create_cancle(){
$('#error').hide();
$('#new_forum_div').slideToggle();
$('#create_btn').parent().slideToggle();
clear_form();
}
function clear_form(){
$("#forum_name").val('');
$("#forum_desc").val('');
}
</script>
<div class="homepageContentContainer mb10">
<div class="homepageContent">
<div class="postContainer">
<div id="new_forum_div" class="mb5" style="display: none">
<div class="red fl mb10" id="error" style="display: none">error</div>
<%= form_tag({:controller => 'forums',:action=>'create',:format=>'js'},:method => 'post',:remote=>'true') do |f| %>
<div class="mt15">
<textarea type="text" name="forum[name]" id="forum_name" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" ></textarea>
<script>
var textarea = document.getElementById('forum_name');
autoTextarea(textarea);
</script>
</div>
<div class="mt15">
<textarea type="text" name="forum[description]" id="forum_desc" class="postCreateInput" placeholder="输入贴吧描述"></textarea>
<script>
var textarea1 = document.getElementById('forum_desc');
autoTextarea(textarea1);
</script>
</div>
<div class="mt10">
<div class="fr"><a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit($(this));">确定</a></div>
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="create_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="postBanner" id="postBanner">
<%= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str}%>
<!--<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class="sortArrowActiveD"></a></div>-->
<!--<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0)" id="reorder_popu" ></a></div>-->
<!--<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0)" id="reorder_time" ></a></div>-->
<!--<div class="creatPost"><a href="javascript:void(0);" id="create_btn" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#new_forum_div').slideToggle();$(this).parent().slideToggle();">新建贴吧</a></div>-->
<!--<div class="cl"></div>-->
</div>
<div id="forum_list">
<%= render :partial => 'forum_list',:locals => {:forums=>@forums}%>
</div>
<ul class="wlist fr" id="pages" style="margin-top: 10px;">
<%= pagination_links_full @forums_pages, @forums_count ,:per_page_links => true,:remote =>true,:flag=>true%>
</ul>
<div class="cl"></div>
</div>
</div>
</div>

View File

@ -0,0 +1,4 @@
//$("#postBanner").html("<%#= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str }%>");
$("#forum_list").html("<%= escape_javascript(render :partial => 'forum_list',:locals => {:forums=>@forums}) %>");
//这里出现一个问题竟然是单双引号引起的。注意!!
$("#pages").html('<%= pagination_links_full @forums_pages, @forums_count,:per_page_links => false,:remote =>true,:flag=>true%>');

View File

@ -1,42 +1,144 @@
<!-- added by fq -->
<div id="add-memo" class='lz' style="<% unless @memo.errors.any?%>display: none;<% end %> padding: 20px;">
<h3>
<%=l(:label_memo_new)%>
</h3>
<% if User.current.logged? %>
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
<div class="actions" style="max-width:680px">
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<p>
<%= f.text_field :subject, :required => true, :maxlength => 50%>
</p>
<p style="max-width:680px">
<%= f.kindeditor :content, :required => true %>
</p>
<!--<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>-->
<p style="color: #ff0000">
(<%= l(:label_memos_max_length) %>)
</p>
<p class="fl" style="margin-top: 5px;">
<%= l(:label_attachment_plural) %>
<br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>
<div class="cl"></div>
<%= f.submit :value => l(:label_memo_create) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
</div>
<% end %>
<% end %>
<%= javascript_include_tag 'new_user' %>
<script>
function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){
$("#"+id).removeClass("sortArrowActiveD");
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
url: '<%= forums_path+"/"+@forum.id.to_s %>' + '.js?' + id + '=asc&page='+<%= @topic_pages.page%>
});
}else if($("#"+id).hasClass("sortArrowActiveU")){
$("#"+id).removeClass("sortArrowActiveU");
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path+"/"+@forum.id.to_s %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path+"/"+@forum.id.to_s %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
});
}
}
$(function() {
$("#complex").click(function(){
$("#reorder_popu").removeClass("sortArrowActiveU");
$("#reorder_popu").removeClass("sortArrowActiveD");
$("#reorder_time").removeClass("sortArrowActiveD");
$("#reorder_time").removeClass("sortArrowActiveU");
add_class("reorder_complex");
});
$("#popu").click(function () {
$("#reorder_complex").removeClass("sortArrowActiveD");
$("#reorder_complex").removeClass("sortArrowActiveU");
$("#reorder_time").removeClass("sortArrowActiveD");
$("#reorder_time").removeClass("sortArrowActiveU");
add_class("reorder_popu");
});
$("#time").click(function () {
$("#reorder_complex").removeClass("sortArrowActiveD");
$("#reorder_complex").removeClass("sortArrowActiveU");
$("#reorder_popu").removeClass("sortArrowActiveU");
$("#reorder_popu").removeClass("sortArrowActiveD");
add_class("reorder_time");
});
<% if @errors %>
$('#create_memo_div').slideToggle();$('#create_memo_btn').slideToggle();
$("#error").html('<%= @errors.html_safe %>').show();
<% end %>
});
function check_and_submit(){
if(!check_memo_name()){
return;
}
if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() != "" ){
$("#new_memo").submit();
}else if($("textarea[name='memo[subject]']").val().trim() == "" && $("textarea[name='memo[content]']").val().trim() != "" ){
$("#error").html("主题不能为空").show();
}else if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() == ""){
$("#error").html("内容不能为空").show();
}
}
function check_memo_name(){
if($("#memo_subject").val().trim().length > 50){
$("#error").html("主题 过长(最长为 50 个字符)").show();
return false;
}
if($("#memo_content").val().trim().length > 5000){
$("#error").html("内容 过长(最长为 5000 个字符)").show();
return false;
}
return true;
}
function create_cancle(){
$('#create_memo_div').slideToggle();
$('#create_memo_btn').slideToggle();
$('#memo_subject').val('');
$('#memo_content').val('')
$('#error').html('').hide();
}
</script>
<div class="postRightContainer">
<div id="create_memo_div" style="display: none">
<div id="error" class="red fl mb10" style="display: none">error</div>
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
<div>
<textarea type="text" name="memo[subject]" id="memo_subject" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子标题" ></textarea>
<script>
var textarea1 = document.getElementById('memo_subject');
autoTextarea(textarea1);
</script>
</div>
<div class="mt15">
<textarea type="text" name="memo[content]" id="memo_content" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子内容" /></textarea>
<script>
var textarea = document.getElementById('memo_content');
autoTextarea(textarea);
</script>
</div>
<div class="mt10">
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">上传附件</a>-->
<%= render :partial => 'file_form', :locals => {:container => @memo} %>
<div class="fr">
<a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit();">确定</a>
</div>
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="create_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="postDetailBanner">
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class="sortArrowActiveD"></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0);" id="reorder_time" class=""></a></div>
<div class="creatPost" id="create_memo_btn"><a href="javascript:void(0);" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#create_memo_div').slideToggle();$(this).parent().slideToggle();">发布新帖</a></div>
<div class="cl"></div>
</div>
<div id="topics_list">
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
</ul>
<!--<div class="pageRoll">-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>-->
<!--<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>-->
<!--</div>-->
<!--<div class="cl"></div>-->
</div>
</div>
<!--modified by huang-->
<span class="contextual-borad">
<%= link_to(image_tag('edit.png')+l(:label_forum_edit),{:action => 'edit', :id => @forum}, :method => 'get', :title => l(:button_edit)) if @forum.editable_by?(User.current) %>
<%= link_to(image_tag('delete.png')+'删除讨论区', {:action => 'destroy', :id => @forum}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete)
) if @forum.destroyable_by?(User.current) %>
</span>
<span>
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
</span>
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>

View File

@ -0,0 +1,2 @@
$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>")
$("#pages").html('<%= pagination_links_full @topic_pages, @topic_count,:per_page_links => false,:remote =>true%>');

View File

@ -1,110 +0,0 @@
<ul class="hwork_new_basic mb10">
<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>
</ul><!--hwork_new_basic end--->
<div class="hwork_new_set" >
<p class="fl ml20 f14 mb10 c_orange">基本规则设置总分为100分</p>
<div class="cl"></div>
<ul class="ml10">
<li>
<label class="label02">迟交扣分:&nbsp;</label>
<%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
<span class="fl mt5">&nbsp;分</span>
<div class="cl"></div>
</li>
<li style="display: none;">
<label class="label02" >是否匿评:&nbsp;</label>
<%= f.check_box :homework_type, :class => "mb10 mt5 fl" %>
<div class="cl"></div>
</li>
<li >
<label class="label02">评分比例:&nbsp;</label>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.ta_proportion), {:class => "fl mb10 h26 w70"} %>
<span class="ml5 fl mt5">×&nbsp;教辅评分</span>
<span class="ml5 fl mt5">&nbsp;&nbsp;+&nbsp;&nbsp;</span>
<input type="text" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion* 100).to_i%>%" class="fl mb10 h26 w70" readonly>
<span class="ml5 fl mt5">×&nbsp;匿评得分</span>
<span class="ml5 fl mt5">=&nbsp;学生得分</span>
<div class="cl"></div>
</li>
<li >
<label class="label02" >&nbsp;&nbsp;</label>
<span class=" fl c_red">如果教师对学生作品进行了评分,则教师评分为学生最终得分。</span>
<div class="cl"></div>
</li>
</ul>
</div><!--hwork_new_set end-->
<div class="hwork_new_set" id="evaluation_setting" >
<p class="fl ml20 f14 mb10 c_orange">学生互评设置</p>
<div class="cl"></div>
<ul class="ml10">
<li style="display: none;">
<label class="label02">互评启动时间:&nbsp;</label>
<input type="text" name="evaluation_start" id="evaluation_start_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_start%>" >
<%= calendar_for('evaluation_start_time')%>
<div class="cl"></div>
</li>
<li style="display: none;">
<label class="label02">互评结束时间:&nbsp;</label>
<input type="text" name="evaluation_end" id="evaluation_end_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_end%>" >
<%= calendar_for('evaluation_end_time')%>
<div class="cl"></div>
</li>
<li >
<label class="label02">匿评分配数:&nbsp;</label>
<input type="text" name="evaluation_num" id="evaluation_num" class=" hwork_input02 fl" value="<%= homework.homework_detail_manual.evaluation_num%>" maxlength="2" onkeyup="regex_evaluation_num()">
<p class="ml5 fl mt5" id="evaluation_num_notice">每个学生将收到<span class="c_red">&nbsp;3&nbsp;</span>份待匿评作品</p>
<div class="cl"></div>
</li>
<li>
<label class="label02">缺评扣分:&nbsp;</label>
<%= select_tag :absence_penalty,options_for_select(absence_penalty_option,homework.homework_detail_manual.absence_penalty), {:class => "fl mb10 h26 w70"} %>
<span class="fl mt5">&nbsp;分</span>
<p class="ml5 fl mt5">学生漏评1个作品将扣<span class="c_red" id="absence_penalty_notice">&nbsp;<%= homework.homework_detail_manual.absence_penalty%>&nbsp;</span>分</p>
<div class="cl"></div>
</li>
</ul> <!-- h1 end--->
</div><!--hwork_new_set end-->

View File

@ -1,193 +0,0 @@
<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>
<li>
<label class="label02">迟交扣分:&nbsp;</label>
<%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
<span class="fl mt5">&nbsp;分</span>
<div class="cl"></div>
</li>
</ul><!--hwork_new_basic end--->
<div class="cl"></div>
<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_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
<div class="cl"></div>
</li>
<li >
<label class="label02">评分比例:&nbsp;</label>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "fl mb10 h26 w70"} %>
<span class="ml5 fl mt5">×&nbsp;教辅评分</span>
<span class="ml5 fl mt5">&nbsp;&nbsp;+&nbsp;&nbsp;</span>
<input type="text" id="student_proportion" value="<%= (100 - homework.homework_detail_programing.ta_proportion* 100).to_i%>%" class="fl mb10 h26 w70" readonly>
<span class="ml5 fl mt5">×&nbsp;系统评分</span>
<span class="ml5 fl mt5">=&nbsp;学生得分</span>
<div class="cl"></div>
</li>
<li >
<label class="label02" >&nbsp;&nbsp;</label>
<span class=" fl c_red">如果教师对学生作品进行了评分,则教师评分为学生最终得分。</span>
<div class="cl"></div>
</li>
<li >
<label class="label02">&nbsp;标准代码:&nbsp;</label>
<textarea name="standard_code" class=" w547 h400 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || c_stantard_code_teacher%></textarea>
<div class="cl"></div>
</li>
<% if edit_mode %>
<% homework.homework_tests.each do |homework_test|%>
<div>
<li>
<label class="label02">&nbsp;测试输入:&nbsp;</label>
<input type="text" class="fl h26 w190 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
</li>
<li >
<label class=" fl f14 ml10">&nbsp;输出:&nbsp;</label>
<input type="text" class="fl h26 w190 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
</li>
<li>
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
<% if homework_test.result && !homework_test.result.to_s.empty?%>
<% if homework_test.result == 0%>
<a class="green_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">正确</a>
<% else%>
<a class="red_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">错误</a>
<% end%>
<% else%>
<a class="blue_btn fl ml5 mt1 programing_test" onclick="programing_test('<%= homework_test.id%>')" id="test_send_<%= homework_test.id%>">测试</a>
<% end%>
<input type="hidden" id="test_result_<%= homework_test.id%>" name="result[<%= homework_test.id%>]" value="<%= homework_test.result%>"/>
</li>
<div class="cl"></div>
</div>
<% end%>
<% else %>
<div>
<li>
<label class="label02">&nbsp;测试输入:&nbsp;</label>
<input type="text" class="fl h26 w190 mb10" name="input[0]" value="1 2"/>
</li>
<li >
<label class=" fl f14 ml10">&nbsp;输出:&nbsp;</label>
<input type="text" class="fl h26 w190 mb10" name="output[0]" value="3"/>
</li>
<li>
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
<a class="blue_btn fl ml5 mt programing_test" onclick="programing_test('0')" id="test_send_0">测试</a>
<input type="hidden" id="test_result_0" name="result[0]" />
</li>
<div class="cl"></div>
</div>
<% end %>
<input type="hidden" name="error_msg" id="homework_test_error_msg" value="<%= homework.homework_tests.first.error_msg if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg%>">
<table class="border_ce" cellpadding="0" cellspacing="0" id="homework_work_test_show" style="display: <%= homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg && !homework.homework_tests.first.error_msg.empty? ? "block" : "none"%>">
<tbody>
<tr class="border_t" >
<td class="td_end fb c_red w60 td_board_left">
错误信息:
</td>
<td class="td_end wl" id="homework_work_test_desc">
<% if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg %>
<%= homework.homework_tests.first.error_msg%>
<% end%>
</td>
</tr>
</tbody>
</table>
</ul>
</div>
<script type="text/javascript">
//点击测试,发送
function programing_test(obj) {
$.post(
'<%= programing_test_homework_common_index_path%>',
{
src: $("textarea[name='standard_code']").val(),
input: $("input[name='input[" + obj +"]']").val(),
output: $("input[name='output[" + obj + "]']").val(),
language: $("select[name='language']").val(),
index: obj
},
function (data) {
}
);
}
function init_programing_test()
{
$(".programing_test").each(function(){
$(this).removeClass("green_btn red_btn").addClass("blue_btn").text("测试");
$(this).next("input").val("");
});
}
function homework_language_change(obj)
{
if(obj.val() == "1")
{
// alert(1);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher%>");
}
else if(obj.val() == "2")
{
// alert(2);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher_%>");
}
}
</script>

View File

@ -1,74 +0,0 @@
<div class="homepageRight">
<div class="HomeWork">
<div class="RightBanner">
<div class="NewsBannerName">发布作业</div>
</div>
<div class="HomeWorkCon">
<div class="mt15">
<textarea class="InputBox W700 " placeholder="请输入作业标题" name="homework_common[name]" id="homework_name" maxlength="255" onkeyup="regex_homework_name();" value="<%= homework.name%>"></textarea>
</div>
<div class=" mt10">
<a href="javascript:void(0);" class="BlueCirBtn fl mr10">导入作业</a>
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 date-input" readonly="readonly" value="<%= homework.end_time%>" placeholder="截止日期"></input>
<div class="fl DateBorder mr10"><a href="javascript:void(0);" class="pic_date"></a></div>
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 date-input" readonly="readonly" value="<%= homework.publish_time%>" placeholder="发布日期"></input>
<div class="fl DateBorder"><a href="javascript:void(0);" class="pic_date"></a></div>
<div class="cl"></div>
</div>
<div class="mt10">
<% 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>
<div class="mt10">
<textarea class="InputBox W700 SearchIcon" placeholder="发送到课程" style="margin-top: 0px; margin-bottom: 0px; height: 29px;"></textarea>
</div>
<div class="mt5">
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr20">上传附件</a>
<a href="javascript:void(0);" class="FilesBtn fl mr15 mt3">资源库</a>
<div class="cl"></div>
</div>
<div class="mt10">
<a href="javascript:void(0);" class=" fl DropBtn">高级功能</a>
<div class="DropLine"></div>
<div class="cl"></div>
</div>
<div class="advanced_option" style="display:none;">
<div class="mt10">
<select class="InputBox W120" required="true">
<option value="语言选择">语言选择</option>
<option value="C语言">C语言</option>
<option value="C++">C++</option>
</select>
</div>
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" required></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" required></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
<div class="cl"></div>
</div>
</div>
<div class="mt10">
<a href="javascript:void(0);" onClick="submit_homework('new_homework_common');" class="BlueCirBtnMini fr">发布</a>
<span class="fr mr10 mt3">或</span><%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'fr mr10 mt3'%>
<div class="cl"></div>
</div>
</div>
</div><!----HomeWork end-->
</div>
<script id="t:test-answer-list" type="text/html">
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" required></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" required></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
<div class="cl"></div>
</div>
</script>

View File

@ -0,0 +1,53 @@
<div class="markPopup" id="popbox02">
<%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id},:method => "post",:remote => true) do |f|%>
<span class="uploadText">匿评设置</span>
<div class="cl"></div>
<div class="mt15">
<span class="f14 fontGrey3 fl mt5">开启匿评</span>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_start%>"/>
<%= calendar_for('evaluation_start_time')%>
</div>
<div class="cl"></div>
<p id="homework_evaluation_start_time" class="c_red"></p>
</div>
<div class="cl"></div>
<div class="mt15">
<span class="f14 fontGrey3 fl mt5">关闭匿评</span>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_end" id="evaluation_end_time" placeholder="关闭匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_end%>"/>
<%= calendar_for('evaluation_end_time')%>
</div>
<div class="cl"></div>
<p id="homework_evaluation_end_time" class="c_red"></p>
</div>
<div class="cl"></div>
<div class="mt15 mb10">
<span class="f14 fontGrey3 mr10 fl mt5">匿评人数</span>
<input type="text" name="evaluation_num" id="evaluation_num" placeholder="默认匿评人数为3" maxlength="2" class="markInput fl" value="<%= @homework_detail_manual.evaluation_num%>"/>
<div class="cl"></div>
<p id="evaluation_num_notice" class="c_red"></p>
</div>
<div class="cl"></div>
<div class="mb20 none">
<span class="f14 fontGrey3 mr10">禁用匿评</span>
<input type="checkbox" />
<span class="f12 c_red ml10">禁用后将无法进行学生互评</span>
</div>
<div class="cl"></div>
<div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" class="sendSourceText" onclick="submit_set_evaluation_attr('<%= @homework.end_time%>');">确定</a>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText linkGrey6" onclick="clickCanel();">取消</a>
</div>
</div>
<div class="cl"></div>
<% end%>
</div>

View File

@ -25,9 +25,9 @@
( <%= link_to homework.student_works.count, student_work_index_path(:homework => homework.id), :class => 'c_red'%> )
</p>
<% if @is_teacher%>
<%= homework_anonymous_comment(homework)%>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework,:is_in_course => 1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
<%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit") %>
<%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit ml10") %>
<%= homework_anonymous_comment(homework)%>
<% elsif @is_student%>
<%= student_anonymous_comment homework %>
<%= student_new_homework homework %>

View File

@ -1,17 +0,0 @@
<%= 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>
<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-->
<div class="cl"></div>

View File

@ -1,30 +0,0 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= 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%>

View File

@ -0,0 +1 @@
clickCanel();

View File

@ -0,0 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att') %>');
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed");

View File

@ -1,2 +1,2 @@
$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('<a class="postOptionLink" title="匿评结束" href="javascript:void(0);">匿评结束</a>');
$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('');
alert('关闭成功');

View File

@ -6,12 +6,11 @@
<li>
<label class="label"><span class="c_red f12">*</span><%= l(:field_status) %></label>
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
<%= f.select :status_id,
(@allowed_statuses.collect { |p| [p.name, p.id] }),
{:no_label => true},
# ajax 刷新
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
:class => "w150" %>
<%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }),
{:no_label => true},
# ajax 刷新
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
:class => "w150" %>
<% else %>
<%= h(@issue.status.name) %>
<% end %>
@ -20,10 +19,9 @@
<li>
<label class="label"><span class="c_red f12">*</span><%= l(:field_priority) %></label>
<% if @issue.safe_attribute? 'priority_id' %>
<%= f.select :priority_id,
(@priorities.collect { |p| [p.name, p.id] }),
{:required => true, :no_label => true}, :disabled => !@issue.leaf?,
:class => "w150" %>
<%= f.select :priority_id, (@priorities.collect { |p| [p.name, p.id] }),
{:required => true, :no_label => true}, :disabled => !@issue.leaf?,
:class => "w150" %>
<% end %>
</li>
<div class="cl"></div>
@ -32,8 +30,8 @@
<label class="label"><%= l(:field_assigned_to) %></label>
<% if @issue.safe_attribute? 'assigned_to_id' %>
<%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to),
{:required => @issue.required_attribute?('assigned_to_id'), :no_label => true},
:class => "w150" %>
{:required => @issue.required_attribute?('assigned_to_id'), :no_label => true},
:class => "w150" %>
<% end %>
</li>
<div class="cl"></div>
@ -41,8 +39,8 @@
<% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %>
<label class="label"><%= l(:field_fixed_version) %></label>
<%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version),
{:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true},
:class => "w150" %>
{:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true},
:class => "w150" %>
<%#= link_to(image_tag('add.png', :style => 'vertical-align: middle;'),
new_project_version_path(@issue.project),
:remote => true,
@ -60,11 +58,7 @@
<li>
<label class="label02"><%= l(:field_start_date) %></label>
<% if @issue.safe_attribute? 'start_date' %>
<%= f.text_field :start_date,
:size => 22,
:disabled => !@issue.leaf?,
:no_label => true,
:required => @issue.required_attribute?('start_date') %>
<%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('start_date') %>
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
@ -72,10 +66,7 @@
<li>
<label class="label02"><%= l(:field_due_date) %></label>
<% if @issue.safe_attribute? 'due_date' %>
<%= f.text_field :due_date, :size => 22,
:disabled => !@issue.leaf?,
:no_label => true,
:required => @issue.required_attribute?('due_date') %>
<%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('due_date') %>
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
@ -83,10 +74,7 @@
<li>
<label class="label02"><%= l(:field_estimated_hours) %></label>
<% if @issue.safe_attribute? 'estimated_hours' %>
<%= f.text_field :estimated_hours, :size => 22,
:disabled => !@issue.leaf?,
:no_label => true,
:required => @issue.required_attribute?('estimated_hours') %>
<%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('estimated_hours') %>
<span class="mt3 ml5"><%= l(:field_hours) %></span>
<% end %>
</li>
@ -94,9 +82,9 @@
<li><label class="label02">&nbsp;% 完成&nbsp;&nbsp;:&nbsp;</label>
<% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
<%= f.select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }),
{:required => @issue.required_attribute?('done_ratio'), :no_label => true},
:onchange => "PrecentChange(this.value)",
:class => "w150" %>
{:required => @issue.required_attribute?('done_ratio'), :no_label => true},
:onchange => "PrecentChange(this.value)",
:class => "w150" %>
<% end %>
</li>
<div class="cl"></div>

View File

@ -0,0 +1,52 @@
<!--属性-->
<div class="pro_info_box mb10">
<%= issue_fields_rows do |rows| %>
<ul class="fl" >
<li><p class="label03" >&nbsp;状态&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= @issue.status.name %></p>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('assigned_to_id') %>
<li><p class="label03" >&nbsp;指派给&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl" >
<li><p class="label03" >&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.priority.name %></span>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('done_ratio') %>
<li><p class="label03" >&nbsp;% 完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.done_ratio %>%</span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl " >
<% unless @issue.disabled_core_fields.include?('start_date') %>
<li><p class="label03" style="width:50px;" >&nbsp;开始&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= format_date(@issue.start_date) %></p>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
<li><p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl " >
<% unless @issue.disabled_core_fields.include?('due_date') %>
<li><p class="label03" >&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= format_date(@issue.due_date)? format_date(@issue.due_date) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %>
<li><p class="label03" >&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %><!--pro_info_box end-->
<%#= render_custom_fields_rows(@issue) %>
<%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
</div>
<!--pro_info_box 属性 end-->

View File

@ -6,21 +6,17 @@
<div id="all_attributes" style="display:none;">
<%= render :partial => 'form', :locals => {:f => f} %>
<div class="ping_C mb10 ml10"></div>
<!--<a remote="true" href="javascript:void(0)" class="blue_btn fl" style="margin-left: 80px;margin-bottom: 10px;margin-top: -10px;" onclick="$('#issue-form').submit();">-->
<!--<%#= l(:button_submit) %>-->
<!--</a>-->
</div>
<% end %><!--end-->
<!--<fieldset><legend><%#= l(:field_notes) %></legend>-->
<!--回复框-->
<% if @journals.present? %>
<div id="history">
<%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
</div>
<% end %>
<div id="journal_issue_note" class="wiki"></div>
<div id="journal_issue_note" class="wiki">
</div>
<input name="issue_quote_new" type="hidden" value="<%= %>" />
<fieldset><legend>回复</legend>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>

View File

@ -28,11 +28,7 @@
<li>
<% if @issue.safe_attribute? 'subject' %>
<label class="label"><span class="c_red f12">*</span>&nbsp;主题&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :subject,
:class => "w576",
:maxlength => 255,
:style => "font-size:small",
:no_label => true %>
<%= f.text_field :subject, :class => "w576", :maxlength => 255, :style => "font-size:small", :no_label => true %>
<!--Added by young-->
<%= javascript_tag do %>
observeAutocompleteField('issue_subject',
@ -53,13 +49,7 @@
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor",
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
# :accesskey => accesskey(:edit),
# :class => "w583",
:width=>'87%',
:resizeType => 0,
:no_label => true %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true %>
<%# end %>
<%#= wikitoolbar_for 'issue_description' %>
<% end %>
@ -68,13 +58,13 @@
</ul>
</div>
<li>
<% if @copy_from && @copy_from.attachments.any? %>
<p>
<%# if @copy_from && @copy_from.attachments.any? %>
<!--<p>-->
<!-- 去除附件复制功能 -->
<!-- <label for="copy_attachments"><#%= l(:label_copy_attachments) %></label>
<#%= check_box_tag 'copy_attachments', '1', @copy_attachments %> -->
</p>
<% end %>
<!--</p>-->
<%# end %>
<% if @copy_from && !@copy_from.leaf? %>
<p>
<label for="copy_subtasks"><%= l(:label_copy_subtasks) %></label>

View File

@ -1,13 +1,13 @@
<div class="splitcontent">
<div class="splitcontentleft">
<% i = 0 %>
<% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %>
<% @issue.editable_custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %></p>
<% if i == split_on -%>
</div><div class="splitcontentright">
<% end -%>
<% i += 1 -%>
<% end -%>
</div>
<div class="splitcontentleft">
<% i = 0 %>
<% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %>
<% @issue.editable_custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %></p>
<% if i == split_on -%>
</div><div class="splitcontentright">
<% end -%>
<% i += 1 -%>
<% end -%>
</div>
</div>

View File

@ -1,4 +1,4 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_issue_edit) %></h2>
</div>
@ -12,6 +12,7 @@
<div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %>
</div>
<div class="talk_txt fl">
<p class="pro_page_tit" style="word-break:break-all;">
<span class='<%= "#{get_issue_type(@issue.tracker_id)[0]} fl" %>' title="<%= get_issue_type(@issue.tracker_id)[1] %>"></span>
@ -20,114 +21,53 @@
</p><br/>
<div class="cl"></div>
<p>由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a>
<%# if @issue.created_on != @issue.updated_on %>
添加于 <%= format_time(@issue.created_on).html_safe %>
<%# else %>
<%#= format_time(@issue.updated_on).html_safe %>
<%# end %>
由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a>添加于 <%= format_time(@issue.created_on).html_safe %>
</div>
<!--talk_txt end-->
<a href="javascript:void(0)" class="talk_edit fr"<%= render :partial => 'action_menu' %></a>
<div class="cl"></div>
<div class="talk_info mb10 list_style" style="word-break:break-all;">
<% if @issue.description? || @issue.attachments.any? -%>
<% if @issue.description? || @issue.attachments.any? -%>
<div class="talk_info mb10" style="word-break:break-all;">
<% if @issue.description? %>
<%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
<%= textAreailizable @issue, :description, :attachments => @issue.attachments %>
<% end %>
</div>
</div>
<% end -%>
<div class="pro_pic_box mb10">
<a href="javascript:void(0)" class="link_img fl">
<!--显示附件、图片-->
<%= link_to_attachment_project @issue, :thumbnails => true %></a><br/>
<% end -%>
<%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
</div><!--pro_pic_box end-->
<div class="cl"></div>
<!--属性-->
<div class="pro_info_box mb10">
<%= issue_fields_rows do |rows| %>
<ul class="fl">
<li><p class="label03">&nbsp;状态&nbsp;&nbsp;:&nbsp;</p>
</div><!--pro_pic_box end-->
<div class="cl"></div>
<p class="pro_info_p"><%= @issue.status.name %></p>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('assigned_to_id') %>
<li><p class="label03">&nbsp;指派给&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl">
<li><p class="label03">&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p" style="width:50px;"><%= @issue.priority.name %></span>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('done_ratio') %>
<li><p class="label03">&nbsp;% 完成&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p" style="width:50px;"><%= @issue.done_ratio %>%</span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<!--属性-->
<%= render :partial => 'attributes_show' %>
<!--pro_info_box 属性 end-->
<ul class="fl ">
<% unless @issue.disabled_core_fields.include?('start_date') %>
<li><p class="label03" style="width:50px;">&nbsp;开始&nbsp;&nbsp;:&nbsp;</p>
<%# 该应用是对issue主题内容的引用对应:to => 'journals#new %>
<!--<div class="cl"></div>-->
<!--<%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %>-->
<div class="cl"></div>
</div>
<p class="pro_info_p"><%= format_date(@issue.start_date) %></p>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
<li><p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl ">
<% unless @issue.disabled_core_fields.include?('due_date') %>
<li><p class="label03">&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p" style="width:120px;"><%= format_date(@issue.due_date) ? format_date(@issue.due_date) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %>
<li><p class="label03">&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p" style="width:120px;"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %><!--pro_info_box end-->
<%#= render_custom_fields_rows(@issue) %>
<%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
</div>
<!--pro_info_box 属性 end-->
<div class="cl"></div>
<%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %></a>
<div class="cl"></div>
</div>
<!--problem_main end-->
<div style="clear: both;"></div>
<!--留言-->
<% if @issue.editable? %>
<div id="update">
<%= render :partial => 'edit' %>
</div>
<p style="padding-top: 5px"></p>
<!--引用时不能修改,剥离出引用内容-->
<%#--引用时不能修改,剥离出引用内容--%>
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="issue_desc_editor.sync();$('#issue-form').submit();">
<%= l(:button_submit) %>
</a>
<% end %>
<%#= submit_tag l(:button_submit) %>
<%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%>
</div>
@ -138,6 +78,7 @@
<%= render :partial => 'changesets', :locals => {:changesets => @changesets} %>
</div>
<% end %>
<div class="cl"></div>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>

View File

@ -5,6 +5,7 @@ $('#issue_notes').val("<%= raw escape_javascript(@content) %>");
%>
$('#issue_private_notes').attr('checked', true);
<% end %>
//quote_issue_journal()
showAndScrollTo("update", "notes");
$('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight;

View File

@ -1,9 +1,9 @@
<style type="text/css">
html{ overflow-x:hidden;}
.scrollsidebar{ position:fixed;bottom:1px; right:1px; background:none; }
.scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; }
.side_content{width:154px; height:auto; overflow:hidden; float:left; }
.side_content .side_list {width:154px;overflow:hidden;}
.show_btn{ width:0; height:112px; overflow:hidden; float:left;margin-top: 200px; cursor:pointer;}
.show_btn{ width:0; height:112px; overflow:hidden; float:left; margin-top:200px; cursor:pointer;}
.show_btn span { display:none;}
.close_btn{width:24px;height:24px;cursor:pointer;}
.side_title,.side_bottom,.close_btn,.show_btn {background:url(/images/sidebar_bg.png) no-repeat; }
@ -13,21 +13,21 @@
.close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;}
.close_btn span { display:none;}
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
.msgserver { margin:2px 0px 0px 4px; padding-top: 0px}
.msgserver a { padding-left:4px;}
.opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;}
.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
.opnionButton:hover{background: #0fa9bb; }
/* blue skin as the default skin */
.side_title {background-position:-195px 0;}
.side_center {background:url(/images/blue_line.png) repeat-y center;}
.side_bottom {background-position:-195px -50px;}
.close_btn {background-position:-44px 0;}
.close_btn:hover {background-position:-66px 0;}
.show_btn {background-position:-119px 0;}
.msgserver a {color:#15bccf; }
.msgserver a:hover { text-decoration:underline; }
.msgserver { margin:10px 0 0px 5px;}
.msgserver a { background:url(/images/sidebar_bg.png) no-repeat -119px -110px; padding-left:22px; display:block; height:24px; }
.opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;}
a.opnionButton{ display:block; background:#269ac9; width:130px; height:26px; margin-top:5px; text-align:center; padding-top:0px; color:#fff;}
a.opnionButton:hover{background: #297fb8; }
/* blue skin as the default skin */
.side_title {background-position:-195px 0;}
.side_center {background:url(/images/blue_line.png) repeat-y center; }
.side_bottom {background-position:-195px -50px;}
.close_btn {background-position:-44px 0;}
.close_btn:hover {background-position:-66px 0;}
.show_btn {background-position:-119px 0;}
.msgserver a {color:#269ac9; }
.msgserver a:hover { text-decoration:underline; }
.closeSidebar {background:url(/images/sidebar_bg.png) 0px -112px no-repeat; width:28px; height:18px; margin-top:65px; position:absolute;}
</style>
<head>
@ -39,7 +39,7 @@
minStatue : true,
skin : 'blue',
durationTime : 1000
}
};
var options = $.extend(defaults, options);
this.each(function(){
@ -56,13 +56,13 @@
if(options.minStatue == "true"){
$(".show_btn").css("float", options.float);
sideContent.css('width', 0);
show_btn.css('width', 25);
show_btn.css('width', 29);
}
//close
closeBtn.bind("click",function(){
sideContent.animate({width: '0px'},"fast");
show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast");
show_btn.stop(true, true).delay(300).animate({ width: '29px'},"fast");
cookiesave('minStatue','true','','','');
});
//show
@ -83,14 +83,10 @@ $(function(){
$("#button1").click(function(){
myTips("<%= l(:label_feedback_success) %>","success");
});
});
function f_submit()
{
// var subject = $("#memo_subject").val();
// var content = $("#memo_content_1").val();
// $("#memo_subject").val(subject+""+ content.substr(0,18)+"...");
$("#new_memo").submit();
}
@ -169,15 +165,15 @@ function cookieget(n)
<div class="side_center">
<div class="custom_service">
<% get_memo %>
<% if @public_forum %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a>
<% end %>
<% end %>
<% if @public_forum %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a>
<% end %>
<% end %>
</div>
<div class="msgserver">
<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #15BCCF;">
@ -188,6 +184,9 @@ function cookieget(n)
<div class="side_bottom"></div>
</div>
</div>
<div class="show_btn"><span><%= l(:label_submit)%></span></div>
<div class="show_btn">
<%= l(:label_submit)%>
<a href="#" class="closeSidebar"></a>
</div>
</div>
</body>

View File

@ -5,7 +5,7 @@
<li class="fl"><a href="<%= agreement_path %>" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
<li class="fl"><a href="<%= forums_path %>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
</ul>
</div>

View File

@ -30,6 +30,7 @@
</div>
</div>
<div class="show_btn">
<span>在线客服</span>
<span><%= l(:label_submit)%></span>
<a href="javascript:void(0)" class="closeSidebar"></a>
</div>
</div>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan','leftside', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'prettify' %>
@ -15,7 +15,114 @@
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
<%= stylesheet_link_tag 'base','header','new_user', :media => 'all'%>
<script>
var desc;
function edit_desc(){
if(<%=@forum.creator.id == User.current.id%>) {
desc = $("#forum_desc_span").html();
$("#forum_desc_span").html("<textarea id='forum_desc_input' onblur='change_forum_desc();' class='homepageSignatureTextarea'>" + desc + "</textarea>");
$("#forum_desc_input").focus();
}
}
function change_forum_desc(){
$.ajax({
url: '<%= forums_path + '/'+@forum.id.to_s+".js" %>',
type: 'PUT',
dataType: 'json',
data:{"forum[description]":$("#forum_desc_input").val().trim()},
success:function(data){
if(data == true){
$("#forum_desc_span").html($("#forum_desc_input").val().trim());
}else{
$("#forum_desc_span").html(desc);
}
}
});
}
function delete_forum_tag(doc){
tag_name = doc.parent().children().eq(0).html().trim();
$.ajax(
"<%= delete_forum_tag_forum_path(@forum)+ '.js?tag_name='%>"+tag_name,
{},
function(data){
alert(data == true)
if(data == true){
doc.parent().remove();
}else{
}
}
);
}
function addTag(){
if(<%=@forum.creator.id == User.current.id%>) {
if ($("input[name='addTag']").val().trim() != "" ) {
if($("input[name='addTag']").val().trim().length <= 14) {
$.get(
'<%= add_forum_tag_forum_path(@forum)%>' + "?tag_str=" + $("input[name='addTag']").val(),
{}
);
$("input[name='addTag']").val('');
}else{
alert("标签名字长度不能超过14个字符");
}
}
}
}
var tagNameHtml; //当前双击的链接的父节点的html
var tagName; //标签的值
var parentCssBorder; //当前双击的链接的父节点
var ele; //当前双击的链接
var taggableId; //标签的id
var taggableType; //被标签的类型
//这里renameTag有两种情况一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id就是第一种情况。如果没有id。就是第二种情况
function rename_tag(domEle,name,id,type){
if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动
return;
}
tagNameHtml = domEle.parent().html()
tagName = name;
parentCssBorder = domEle.parent().css("border");
ele = domEle;
taggableId = id;
taggableType = type;
width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width+'px;" value="'+name+'"/>');
domEle.parent().css("border","1px solid #ffffff");
$("#renameTagName").focus();
}
//监听所有的单击事件
$(document).click(function(e){
node = document.elementFromPoint(e.clientX, e.clientY);
if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
return;
}
if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
}else{ //否则就要更新tag名称了
if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){
$.post(
'<%= update_tag_name_path %>',
{"taggableId": taggableId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim()}
)
}else{
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
}
}
}
});
</script>
</head>
<body class="<%= h body_css_classes %>">
@ -28,82 +135,77 @@
<% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="homepageLeft">
<div class="postDetailContainer">
<div class="fl mr10 pr"> <%= link_to image_tag(url_to_avatar(@forum.creator),:width=>75,:height => 75,:alt=>'贴吧图像' ),user_path( @forum.creator) %>
<!--<div class="homepageEditProfile"><a href="javascript:void(0);" class="homepageEditProfileIcon"></a></div>-->
</div>
<div class="fl">
<div class="f16 fontBlue mb10"><a href="<%= forums_path+"/"+@forum.id.to_s%>" style="word-break: break-all; word-wrap:break-word;"><%= @forum.name%></a></div>
<div class="fontGrey2 mb8">吧主:<a href="<%= user_path(@forum.creator)%>" class="linkBlue"><%= @forum.creator.name%></a></div>
<div class="fontGrey3">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @forum.memo_count %></a> 帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%=@forum.topic_count%></a></div>
</div>
<div class="cl"></div>
<div class="fontGrey2 mt10"><span id="forum_desc_span" style="word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;"><%= @forum.description%></span>
<%if @forum.creator.id == User.current.id%>
<a href="javascript:void(0);" onclick="edit_desc();">
<!--<img src="<%#= Rails.root%>/images/signature_edit.png" width="12" height="12" />-->
<%= image_tag('signature_edit.png',{:width=>12,:height=>12})%>
</a>
<%end%>
</div>
<div class="mt15">
<div id="forum_tag_list">
<%= render :partial=>'forums/forum_tag_list',:locals=>{:forum=>@forum}%>
</div>
<% if(@forum.creator.id == User.current.id)%>
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();">+ 添加标签</a>
<% end %>
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
<input type="text" name="addTag" size="20" class="isTxt w90 f_l" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" />
<input type="button" class="submit f_l" onclick="addTag();" />
</span></div>
<div class="cl"></div>
<%if @forum.creator.id == User.current.id%>
<span class="postEdit">
</span>
<a href="<%= edit_forum_path(@forum) %>" class="linkGrey3">编辑贴吧</a>
<a href="<%= forum_path(@forum)%>" data-method="delete" onclick="return confirm('您确定要删除么?');" class="fr linkGrey3">删除贴吧</a>
<span class="postDelete"></span>
<% end %>
</div>
<div class="postDetailContainer mt10">
<div class="fl mr10"><%= link_to image_tag(url_to_avatar(User.current),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path( User.current) %></div>
<div class="fl f16 fontGrey2">我在贴吧</div>
<div class="cl"></div>
<div class="mt8">
<div class="homepageImageBlock" style="width: 68px !important;">
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_replies_count%></a></div>
<div class="homepageImageText">回答</div>
</div>
<div class="homepageVerDiv"></div>
<div class="homepageImageBlock" style="width: 68px !important;">
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_topic_count%></a></div>
<div class="homepageImageText">发帖</div>
</div>
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<div id="main">
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<%#= form_tag(:controller => 'forums', :action => "search_memo", :id => params[:id], :method => :get) do %>
<%#= text_field_tag 'name', params[:name], :size => 20 %>
<%#= hidden_field_tag 'forum_id', params[:id] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%# end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%= link_to request.host()+"/forums", forums_path %></td>
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %></p></td>
</tr>
</table>
</div>
<div id="sidebar">
<!--informations-->
<div class="sidebar-forums">
<div class="forums-line">
<div class="forums-title"><%= @forum.name %></div>
<div class="forums-description upload_img"><%= @forum.description.html_safe %></div>
</div>
<!--informations-->
<div class="formus-first-title" >创建人信息</div>
<div class="forums-info">
<div style="padding-top: 20px" >
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class =>'vatar-size') %></span>
<span class="forums-avatar-right">
<% unless @forum.creator.nil? %>
<%=link_to @forum.creator.name, user_path(@forum.creator) %>
<div>
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %>
</div>
<% end %>
</span>
</div>
</div>
<!--tags-->
<% if User.current.logged? || User.current.admin? %>
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"}%></div>
<% end %>
</div>
</div>
<div id="content">
<div class="cl"></div>
</div>
</div>
</div>
<!--<%#= render_flash_messages %>-->
<%= yield %>
<%#= call_hook :view_layouts_base_content %>
</div>
</div>
</div>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</div>
<%#= render :partial => 'layouts/base_footer'%>
</div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= call_hook :view_layouts_base_body_bottom %>
<%#= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -170,9 +170,9 @@
<div class=" mt10">
<h3 class="mb10 c_blue">请选择项目类型:</h3>
<ul class="mb10" id="project_type">
<li><input type="radio" name="project_type" <%= @project.project_new_type == 1 ? 'checked' : ''%> id="development_group"/><label class="f14">&nbsp;&nbsp;开发模式:<span class="f12 ml5 c_grey">为团队开发提供一系列在线协同工具。</span></label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 2 ? 'checked' : ''%> id="research_group"/><label class="f14">&nbsp;&nbsp;研讨模式:<span class="f12 ml5 c_grey">为小组研究提供阶段汇报和交流工具。</span></label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14">&nbsp;&nbsp;圈子模式:<span class="f12 ml5 c_grey">为朋友圈提供简洁的交流和分享工具。</span></label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 1 ? 'checked' : ''%> id="development_group"/><label class="f14">&nbsp;&nbsp;开发模式:<span class="f12 ml5 c_grey">面向小组开发,支持问题跟踪、代码托管、论坛交流等所有功能。</span></label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 2 ? 'checked' : ''%> id="research_group"/><label class="f14">&nbsp;&nbsp;研讨模式:<span class="f12 ml5 c_grey">面向小组研究,支持任务分工、论坛交流、资源分享等。</span></label></li>
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14">&nbsp;&nbsp;圈子模式:<span class="f12 ml5 c_grey">面向好友分享,支持论坛交流、资源分享等。</span></label></li>
</ul>
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>
</div>

View File

@ -7,16 +7,16 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" ,'prettify'%>
<%= javascript_include_tag "jquery.leanModal.min" ,'prettify','avatars'%>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
<%= stylesheet_link_tag 'base','header','new_user' ,:media => 'all'%>
</head>
<body>
<div class="cl"></div>
@ -29,27 +29,27 @@
</div>
<div class="cl"></div>
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%#=render :partial => 'layouts/base_header'%>
<div id="main" class="nosidebar">
<div id="content_">
<!--<div id="wrapper">-->
<!--<div id="wrapper2">-->
<!--<div id="wrapper3">-->
<!--<%#=render :partial => 'layouts/base_header'%>-->
<!--<div id="main" class="nosidebar">-->
<!--<div id="content_">-->
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</div>
<!--</div>-->
</div>
</div>
<!--</div>-->
<!--</div>-->
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<!--</div>-->
<!--</div>-->
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>

View File

@ -1,5 +1,11 @@
<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %>
<hr />
<h1><%= link_to(h(@project.name), @applied_url) %></h1>
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
<ul style="list-style-type:none; margin:0; padding:0;">
<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">
<p><%=link_to @user.show_name, user_url(@user) %> 申请加入项目:<%=link_to @project.name, @applied_url %> </p>
</span>
</li>
</ul>
<div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
</div>

View File

@ -1,4 +1,7 @@
<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %>
<%= l(:mail_issue_content)%>
<%=link_to @user.show_name, user_url(@user) %>
<%=link_to @project.name, @applied_url %>
<h1><%= link_to(h(@project.name), @applied_url) %></h1>

View File

@ -0,0 +1,71 @@
<div class="mt10 fl" >
<% for attachment in attachments %>
<!--<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">-->
<!--<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">-->
<!--<span title="<%#= attachment.filename%>" id = "attachment_">-->
<% if options[:length] %>
<span class="pic_files fl "></span>
<%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true,:length => options[:length] -%>
<a class="fl FilesName02"> (<%= number_to_human_size attachment.filesize , :precision => 0 %>)</a>
<% if options[:deletable] %>
<%#= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => 'delete',
#:remote => true,
#:id => "attachments_" + attachment.id.to_s,
:title => l(:button_delete) %>
<span class="pic_del fl "> <a href="<%=attachment_path(attachment) %>" onclick="confirm(<%=l(:text_are_you_sure) %>)" data-method="delete"> </a></span>
<% end %>
<div class="cl"></div>
<% else %>
<span class="pic_files fl "></span>
<%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true, :length => 32 -%>
<a href="javascript:void(0);" class="fl FilesName02"> (<%= number_to_human_size attachment.filesize , :precision => 0 %>)</a>
<% if options[:deletable] %>
<%#= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => 'delete',
#:remote => true,
#:id => "attachments_" + attachment.id.to_s,
:title => l(:button_delete) %>
<a href="<%=attachment_path(attachment) %>" onclick="confirm(<%=l(:text_are_you_sure) %>)" data-method="delete"> <span class="pic_del fl "></span> </a>
<% end %>
<div class="cl"></div>
<% end %>
<%# if attachment.is_text? %>
<%#= link_to image_tag('magnifier.png'),
:controller => 'attachments',
:action => 'show',
:id => attachment,
:filename => attachment.filename%>
<%# end %>
<!--<span title="<%#= attachment.description%>">-->
<!--<%#= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %>-->
<!--</span>-->
<!--<%# if options[:wrap] %>-->
<!--<br/>-->
<!--&nbsp;-->
<!--<%# end %>-->
<!--<%# if options[:author] %>-->
<!--<span class="author" title="<%#= attachment.author%>">-->
<%#= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>
<!--<%#= format_time(attachment.created_on) %>-->
<!--</span>-->
<!--<%# end %>-->
<!--</p>-->
<% end %>
<% if defined?(thumbnails) && thumbnails %>
<% images = attachments.select(&:thumbnailable?) %>
<% if images.any? %>
<div class="pro_pic mb10" width="100" height="73">
<% images.each do |attachment| %>
<div><%= thumbnail_tag(attachment) %></div>
<% end %>
</div>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1,36 @@
<!-- get_praise_num(obj,1)函数中 1代表返回顶得次数 0返回踩的次数 -->
<% if User.current.logged? %>
<% if horizontal %>
<!-- 横排 -->
<div id="praise_tread_<%= obj.id %>" style="float:right;">
<% @is_valuate = is_praise_or_tread(obj,user_id)%>
<% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 -->
<% @flag = @is_valuate.first.praise_or_tread %>
<% if @flag == 1 %> <!-- 顶过 --><!-- modified by bai -->
<a href="javascript:void(0);" class="linkGrey2 postLikeIcon" title="<%= l(:label_issue_praise_over)%>" > <%= get_praise_num(obj)%></a>
<% end %>
<% else %>
<% if user_id == obj.author_id %>
<!--<%#= image_tag "/images/praise_tread/praise_true.png" , weight:"22px", height:"22px",:title => l(:label_issue_not_praise_over) %>-->
<a href="javascript:void(0);" class="linkGrey2 postLikeIcon" title="<%= l(:label_issue_not_praise_over)%>" > <%= get_praise_num(obj)%></a>
<% else %>
<!-- 积分少于2分不能踩帖 -->
<%# if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>
<%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %>
<a href="<%= praise_tread_praise_plus_path({:obj_id=>obj.id,:obj_type=>obj.class,:horizontal => horizontal })%>" data-remote="true" class="linkGrey2 postLikeIcon" title="<%= l(:label_issue_praise)%>" > <%= get_praise_num(obj)%></a>
<!--<%# else %>-->
<!--<%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),-->
<!--:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %>-->
<!--<a href="javascript:void(0);" class="linkGrey2 postLikeIcon" title="<%#= l(:label_issue_praise)%>" target="_blank"> <%#= get_praise_num(obj)%></a>-->
<!--<%# end %>-->
<% end %>
<% end %>
</div>
<% end %>
<% end %>

View File

@ -1,55 +1,47 @@
<!-- <h1>New memo</h1> -->
<% @replying = !@memo.parent.nil? %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<h3><%=l(:label_memo_edit)%></h3>
<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo)) do |f| %>
<% if @memo.errors.any? %>
<div id="error_explanation">
<h2>
<%= pluralize(@memo.errors.count, "error") %>
prohibited this memo from being saved:
</h2>
<ul>
<% @memo.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<% end %>
</ul>
</div>
<% end %>
<div class="actions">
<p>
<% if @memo.parent.nil? && @memo.children.first.nil? %>
<%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%>
<% else %>
<%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%>
<% end %>
</p>
<% if User.current.admin?%>
<p>
<% unless @replying %>
<% if @memo.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'memo_sticky', l(:label_board_sticky) %>
<% end %>
<% if @memo.safe_attribute? 'lock' %>
<%= f.check_box :lock %> <%= label_tag 'memo_locked', l(:label_board_locked) %>
<% end %>
<% end %>
</p>
<% end %>
<p>
<%= f.kindeditor :content, :required => true, :size => 80,:owner_id => @memo.id,:owner_type => 1 %>
</p>
<!-- <script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
<p style="float: left;margin-top: 5px;">
<%= l(:label_attachment_plural) %>
<br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>
<br/>
<div class="cl"></div>
<%= f.submit :value => l(:button_change) %>&nbsp;&nbsp;<%= link_to l(:button_back), back_url ,:class => "button-canel",:style => "color: #ffffff;"%>
<%= javascript_include_tag 'new_user'%>
<script>
$(function(){
limitStrsize('memo_subject',50);
limitStrsize('memo_content',5000);
});
function check_and_submit(){
if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() != "" ){
$("#edit_memo").submit();
}else if($("textarea[name='memo[subject]']").val().trim() == "" && $("textarea[name='memo[content]']").val().trim() != "" ){
$("#error").html("主题不能为空").show();
}else if($("textarea[name='memo[subject]']").val().trim() != "" && $("textarea[name='memo[content]']").val().trim() == ""){
$("#error").html("内容不能为空").show();
}
}
</script>
<div class="homepageRightBanner mt15">
<div class="NewsBannerName">编辑帖子</div>
</div>
<div class="postRightContainer" style="margin-top: 15px">
<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id=>'edit_memo'}) do |f| %>
<div id="error" style="display: none">
</div>
<div>
<textarea type="text" id="memo_subject" name="memo[subject]" class="postDetailInput" placeholder="对应帖子标题" ><%= @memo.subject%></textarea>
<script>
var ta = document.getElementById('memo_subject')
autoTextarea(ta)
</script>
</div>
<% end %>
<div class="mt15">
<textarea type="text" id="memo_content" name="memo[content]" class="postDetailInput" placeholder="对应帖子内容" ><%= @memo.content.html_safe%></textarea>
<script>
var ta1 = document.getElementById('memo_content')
autoTextarea(ta1)
</script>
</div>
<div class="mt10">
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">对应附件名称</a>-->
<%= render :partial => 'forums/file_form', :locals => {:container => @memo} %>
<div class="fr"><a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit();">确定</a></div>
<div class="fr"><a href="<%= forum_memo_path(@memo.forum,@memo)%>" class="linkGrey2 mr10">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div>

View File

@ -1,188 +1,117 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor","forum" %>
<style type="text/css">
.reply_content p {
margin-top: 13px;
margin-bottom: 13px;
}
/*回复框*/
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;}
.ke-inline-block{display: none;}
div.ke-container{float:left;}
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<div class="lz">
<!-- 在这里添加赞和踩-->
<span id="praise_tread" style="float: right">
<%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
</span>
<div class="lz-left">
<div>
<%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %>
</div>
<p class="clearfix">
<%=link_to @memo.author.name, user_path(@memo.author) %>
</p>
</div>
<div class="memo-section">
<div class="contextual-borad">
<!-- <%#= link_to(
image_tag('comment.png'),
{:action => 'quote', :id => @memo},
:remote => true,
:method => 'get',
:title => l(:button_quote)
)if !@memo.locked? && User.current.logged? %> -->
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => @memo},
:remote => true,
:method => 'get',
:title => l(:button_quote)
)if !@memo.locked? && User.current.logged? %>
<%= link_to(
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => @memo},
:method => 'get',
:title => l(:button_edit)
) if @memo.editable_by?(User.current) %>
<!-- <%#= link_to(
image_tag('delete.png'),
{:action => 'destroy', :id => @memo},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if @memo.destroyable_by?(User.current) %> -->
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @memo},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if @memo.destroyable_by?(User.current) %>
</div>
<div>&nbsp;</div>
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>"
style="word-break: break-all;word-wrap: break-word;">
<%= label_tag l(:field_subject) %>:
<%=h @memo.subject %>
</div>
<div class="memo-content" id="memo-content_div">
<%= @memo.content.html_safe %>
<p>
<% if @memo.attachments.any?%>
<% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>
<%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %>
<% end %>
</p>
<div class="clearfix"></div>
</div>
<div class="memo-timestamp">
<%= authoring @memo.created_at, @memo.author %>
</div>
</div>
<br />
</div>
<div class="replies">
<h3 class="comments"><%= l(:label_reply_plural) %> (<%= @replies.nil? ? 0 : @replies.size %>)</h3>
<% pages_count = @reply_pages.offset %>
<% @replies.each do |reply| %>
<div class="reply" id="<%= "reply-#{reply.id}" %>">
<p class="font_lighter"><!--<span style="display: inline"><%#= pages_count += 1 %>楼 :</span>--></p>
<div class="contextual-borad">
<!-- <%#= link_to(
image_tag('comment.png'),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:title => l(:button_quote)
)if !@memo.locked? && User.current.logged? %> -->
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:title => l(:button_quote)
)if !@memo.locked? && User.current.logged? %>
<%= link_to(
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => reply},
:title => l(:button_edit)
) if reply.editable_by?(User.current) %>
<!-- <%#= link_to(
image_tag('delete.png'),
{:action => 'destroy', :id => reply},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.destroyable_by?(User.current) %> -->
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.destroyable_by?(User.current) %>
</div>
<br/>
<table class="borad-text-list" style="table-layout: fixed;">
<tr>
<td rowspan="3" valign="top" width="60px">
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
</td>
<td class="comments" style="word-wrap: break-word;word-break: break-all;">
<div class="reply_content" >
<%=h sanitize(reply.content.html_safe) %>
</div>
<p>
<% if reply.attachments.any?%>
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
<%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options, :is_float => true} %>
<% end %>
</p>
</td>
</tr>
<tr>
<td class="font_lighter" style="float:right">
<%= authoring reply.created_at, reply.author %>
</td>
</tr>
</table>
</div>
<% end %>
<div class="pagination">
<%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %>
</div>
</div>
<% if User.current.login? %>
<div class="reply-box" style="">
<%= render :partial => 'reply_box' %>
</div>
<% else %>
<div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %>
<hr/>
</div>
<% end %>
<script type="text/javascript">
jQuery(document).ready(function($) {
transpotUrl('.lz');
transpotUrl('.replies');
<script>
function expand_reply(container,btnid){
var target = $(container).children();
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复('+btn.data('count')+')');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多('+btn.data('count')+')');
target.hide();
target.eq(0).show();
target.eq(1).show();
}
}
$(function() {
init_activity_KindEditor_data(<%= @memo.id%>,null,"87%");
});
window.onready = function() {
var maxwidth = $("#memo-content_div").width();
$("#memo-content_div").children().each(function(){
if($(this).width()>maxwidth)
{
$(this).width(maxwidth);
}
});
};
$("img").removeAttr("align");
</script>
<div class="postRightContainer">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %>
</div>
<div class="postThemeWrap">
<% if @memo.author.id == User.current.id%>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="<%= edit_forum_memo_path(@memo.forum,@memo)%>" class="postOptionLink">编辑</a></li>
<li><a href="<%= forum_memo_path(@memo.forum,@memo) %>" data-method="delete" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
<%end%>
<div class="postDetailTitle"><a href="javascript:void(0);" class="f14 linkGrey4 fb">主题: <%= @memo.subject%></a></div>
<div class="postDetailCreater"><a href="javascript:void(0);" class="linkBlue2" target="_blank"><%= @memo.author.name%></a></div>
<div class="postDetailDate mb5"><%= format_date( @memo.created_at)%></div>
<span id="praise_tread" style="float: right">
<%= render :partial => "memos/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
</span>
<div class="cl"></div>
<div class="fl fontGrey3" style="word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;">
<%= @memo.content.html_safe%>
</div>
<div class="cl"></div>
<div class="mt10 fl">
<% if @memo.attachments.any?%>
<% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>
<%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %>
<% end %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %></div>
<div class="homepagePostReplyBannerTime"></div>
<div class="homepagePostReplyBannerMore">
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%= @memo.id%>" onclick="expand_reply('#reply_div_<%= @memo.id %>','#reply_btn_<%= @memo.id%>')" data-count="<%= @reply_count %>" data-init="0" >点击展开更多回复</a>
</div>
</div>
<div class="" id="reply_div_<%= @memo.id %>">
<% @replies.each_with_index do |reply,i| %>
<div class="homepagePostReplyContainer" style="display: <%= i >= 2 ? 'none':''%>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.name%></a><%= format_date(reply.created_at) %></div>
<div class="homepagePostReplyContent"><%= reply.content.html_safe%></div>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="cl"></div>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @memo.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= @memo.id%>' style="display:none;">
<%= form_for('memo',:url=>forum_memos_path,:method => "post") do |f|%>
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @memo.id%>' name="memo[content]"></textarea>
<div nhname='toolbar_container_<%= @memo.id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= @memo.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= @memo.id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
</div>

View File

@ -1,4 +1,9 @@
$('#praise_tread_<%= @obj.id %>').html('<%= j(
render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal}
)%>');
<% if @obj_type == 'Memo'%>
$('#praise_tread_<%= @obj.id %>').html('<%= j(
render :partial => "/memos/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal}
)%>');
<% else %>
$('#praise_tread_<%= @obj.id %>').html('<%= j(
render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal}
)%>');
<% end %>

View File

@ -0,0 +1,28 @@
<%# 这些代码删除也没什么影响,暂时放着,待优化 %>
<%= wikitoolbar_for 'project_description' %>
<% @project.custom_field_values.each do |value| %>
<p>
<%= custom_field_tag_with_label :project, value %>
</p>
<% end %>
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>
<% unless @project.identifier_frozen? %>
<% content_for :header_tags do %>
<%= javascript_include_tag 'project_identifier' %>
<% end %>
<% end %>
<% if !User.current.admin? && @project.inherit_members? && @project.parent && User.current.member_of?(@project.parent) %>
<%= javascript_tag do %>
$(document).ready(function() {
$("#project_inherit_members").change(function(){
if (!$(this).is(':checked')) {
if (!confirm("<%= escape_javascript(l(:text_own_membership_delete_confirmation)) %>")) {
$("#project_inherit_members").attr("checked", true);
}
}
});
});
<% end %>
<% end %>

View File

@ -1,23 +1,112 @@
<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<%= labelled_form_for @project do |f| %>
<div class="project_new">
<%=l(:label_project_new)%>
<span class="description">
</span>
<div class="box tabular" >
<p style="font-weight: bold; color: rgb(237,137,36)">
<%=raw l(:label_project_new_description)%>
</p>
<%= render :partial => 'form', :locals => { :f => f } %>
<span style="padding-left: 60px">
<%= submit_tag l(:button_create), :class => "enterprise"%>
</span>
</div>
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<%= javascript_tag "$('#project_name').focus();" %>
</div>
<% end %>
<%= error_messages_for 'project' %>
<div class="project_r_h02">
<h2 class="project_h2"><%= l(:label_project_new)%></h2>
</div>
<div class="hwork_new">
<ul>
<%= labelled_form_for @project do |f| %>
<li class="ml45">
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_projects_new_name)%>&nbsp;&nbsp;</label>
<input type="text" name="project[name]" id="project_name" class="courses_input" maxlength="100" onkeyup="regex_project_name();">
<span class="c_red" id="project_name_notice" style="display: none;">项目名称不能为空</span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_type_project)%>&nbsp;&nbsp;</label>
<%= select_tag :project_new_type, options_for_select([["开发模式", "1"], ["研讨模式", "2"], ["圈子模式", "3"]]) %>
<span class=" ml15 c_orange" id = "project_newtype_select"><%=l(:label_type_des_development) %></span>
</li>
<div class="cl"></div>
<li class="ml45">
<label class="fl" >&nbsp;&nbsp;<%= l(:label_tags_project_description) %>&nbsp;&nbsp;</label>
<textarea name="project[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" ></textarea>
<div class="cl"></div>
</li>
<li>
<p style="display: none" >
<%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
<% unless @project.identifier_frozen? %>
<em class="info">
<%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_project_identifier_info).html_safe %>
</em>
<% end %></p>
</li>
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input id="project_is_public" name="project[is_public]" type="checkbox" value="1" checked="checked">
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。)</span>
<div class="cl"></div>
</li>
<li>
<p style="display:none;">
<%= f.text_field :project_type, :value => 0 %>
</p>
</li>
<li>
<%= render :partial => 'form_new', :locals => { :f => f } %>
</li>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_project();" >提交</a>
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
<div class="cl"></div>
</li>
<% end%>
</ul>
</div><!--talknew end-->
<div class="cl"></div>
<% html_title(l(:label_project_new)) -%>
<script>
//////////////////////////////////////////////////////////////
//新建项目
//验证项目名称
function regex_project_name()
{
var name = $.trim($("#project_name").val());
if(name.length == 0)
{
$("#project_name_notice").show();
return false;
}
else
{
$("#project_name_notice").hide();
return true;
}
}
//提交新建项目
function submit_new_project()
{
if(regex_project_name())
{
$("#new_project").submit();
}
}
$(function(){
$('#project_new_type').change(function(){
var type = $('#project_new_type').val();
if(type == '1'){
$(this).next().html("<%= l(:label_type_des_development)%>");
}
else if(type == '2'){
$(this).next().html("<%= l(:label_type_des_research)%>");
}
else if(type == '3'){
$(this).next().html("<%= l(:label_type_des_friend)%>");
}
// var p1=$(this).children('option:selected').val("研讨模式:面向小组研究,支持任务分工、论坛交流、资源分享等。");//这就是selected的值
// var p2=$('#param2').val();//获取本页面其他标签的值
})
})
</script>

View File

@ -5,9 +5,8 @@
<%= render :partial=>"avatar/new_avatar_form",:locals=> {source:@project} %>
<div class="cl"></div>
</li>
<li >
<label class="label02"><span class="c_red">*</span>&nbsp;名称&nbsp;&nbsp;</label>
<label class="label02"><span class="c_red">*</span>&nbsp;项目名称&nbsp;&nbsp;</label>
<!--<input id="project_name" name="project[name]" class=" w543" type="text" value="<%#= @project.name%>">-->
<input type="text" name="project[name]" id="project_name" class="w543" maxlength="100" onkeyup="regex_project_name();" value="<%= @project.name %>">
<span class="c_red ml110" id="project_name_notice" style="display: none;">项目名称不能为空!</span>
@ -15,7 +14,7 @@
<div class="cl"></div>
<li >
<label class="label02" >&nbsp;&nbsp;描述&nbsp;&nbsp;</label>
<label class="label02" >&nbsp;&nbsp;项目描述&nbsp;&nbsp;</label>
<textarea class="w543" id="project_description" name="project[description]" rows="8" placeholder="最多3000个汉字(或6000个英文字符)"><%= @project.description%></textarea>
<div class="cl"></div>
</li>
@ -24,11 +23,6 @@
<input id="project_is_public" name="project[is_public]" type="checkbox" <%= @project.is_public ? "checked" : ""%>>
<div class="cl"></div>
</li>
<li >
<label class="label02">隐藏代码库&nbsp;&nbsp;</label>
<input id="project_hidden_repo" name="project[hidden_repo]" type="checkbox" <%= @project.hidden_repo ? "checked" : ""%>>
<div class="cl"></div>
</li>
</ul>
<a href="javascript:void(0)" class="blue_btn ml110" onclick="submit_edit_project(<%= @project.id %>);" >保存</a>
<% end %>

View File

@ -3,27 +3,29 @@
<li class="hworkList340 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<ul>
<li class="hworkPortrait mt15 mr10">
<%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %>
</li>
<li class="hworkName mt15 mr15 <%= @homework.homework_type == 2 ? '' : 'width165'%>">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</li>
<li>
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
</li>
<li class="hworkStID mt16" title="学号">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</ul>
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(User.current.id))%>
</li>
<div onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<li class="hworkName mt15 mr15 <%= @homework.homework_type == 2 ? '' : 'width165'%>">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</li>
<li>
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
</li>
<li class="hworkStID mt16" title="学号">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</ul>
</li>
</div>
</ul>
</li>
<li class="hworkList130 c_grey">
<li class="hworkList130 c_grey" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>

View File

@ -14,24 +14,34 @@ $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project
$('#tags_name2').val("");
<% elsif @obj_flag == '6'%>
<%if @course%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
:locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>');
<% if @obj %>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
:locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>');
$("#tags_name_<%=@obj.id%>").val("");
$("#add_tag_<%=@obj.id%>").hide();
<% else %>
$("#course_list").html("<%= escape_javascript(render :partial => 'files/course_list',
:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments}) %>");
<% end %>
$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>");
<%else%>
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
<%end%>
$("#tags_name_<%=@obj.id%>").val("");
$("#add_tag_<%=@obj.id%>").hide();
<%end%>
<% elsif @obj_flag == '9'%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
$('#tags_name').val("");
<% elsif @obj_flag == '10'%>
//$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide();
<% elsif @obj_flag == '5'%>
$('#forum_tag_list').html('<%= escape_javascript(render :partial=>'forums/forum_tag_list',:locals=>{:forum=>@forum})%>')
<% else%>
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');

View File

@ -107,7 +107,7 @@
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>

View File

@ -77,7 +77,7 @@
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>

View File

@ -121,7 +121,7 @@
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>

View File

@ -92,7 +92,7 @@
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>

View File

@ -21,14 +21,6 @@
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<%= calendar_for('homework_end_time')%>
</div>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_start%>" >
<%= calendar_for('evaluation_start_time')%>
</div>
<div class="calendar_div fl ml10">
<input type="text" name="evaluation_end" id="evaluation_end_time" placeholder="关闭匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_end%>" >
<%= calendar_for('evaluation_end_time')%>
</div>
</div>
<div class="cl"></div>
<p id="homework_end_time_span" class="c_red mt5"></p>

View File

@ -60,6 +60,9 @@
<li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) if homework_common.homework_detail_manual.comment_status == 1%>
</li>
<li>
<%= homework_anonymous_comment homework_common %>
</li>

View File

@ -4,7 +4,7 @@
<div class="HomeWorkCon">
<div class="mt15">
<select class="InputBox W120 language_type" >
<%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
<%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3, "Java"=>4}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
</select>
</div>
<% if edit_mode && homework.is_program_homework? %>

View File

@ -7,10 +7,6 @@
homework_description_editor.html("");
$("#homework_editor").toggle();
}
function checkAllBox(doc){
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">作业</div>

View File

@ -118,17 +118,47 @@
<% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了作业:</span></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<li class="homepageNewsPubTypeHomework fl"><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotReadHomework fl":"homepageNewsTypeHomework fl" %>">发布了作业于课程:<%= ma.course_message.course.name %></span>
</li>
<li class="homepageNewsContent fl" style="width:315px;"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.description.html_safe %></div>
<% if User.current.members.where("course_id = ?", ma.course_message.course.id).first.roles.first.name == 'Student' %>
<p>您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业,详情如下:</p>
<p><strong>课程:</strong><%= ma.course_message.course.name %>
(<%= ma.course_message.course.term %>)</p>
<p><strong>作业标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<% end %>
<p><strong>作业提交截止日期:</strong><%= ma.course_message.end_time %></p>
<p><strong>匿评自动关闭日期:</strong><%= ma.course_message.homework_detail_manual.evaluation_end %></p>
<p><strong>迟交扣分:</strong><%= ma.course_message.late_penalty %>分</p>
<p>
请同学们抓紧时间提交自己的作品,谢谢!
</p>
<% else %>
<p>您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业,详情如下:</p>
<p><strong>课程:</strong><%= ma.course_message.course.name %>
(<%= ma.course_message.course.term %>)</p>
<p><strong>作业标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<% end %>
<p><strong>作业提交截止日期:</strong><%= ma.course_message.end_time %></p>
<p><strong>匿评自动开始日期:</strong><%= ma.course_message.homework_detail_manual.evaluation_start %></p>
<p><strong>匿评自动关闭日期:</strong><%= ma.course_message.homework_detail_manual.evaluation_end %></p>
<p><strong>迟交扣分:</strong><%= ma.course_message.late_penalty %>分</p>
<p><strong>缺评扣分:</strong><%= ma.course_message.homework_detail_manual.absence_penalty %>分</p>
<p>
您可以修改作业内容、评分规则、匿评过程等,谢谢!
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
@ -146,7 +176,39 @@
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
<% if User.current.members.where("course_id = ?", ma.course_message.course.id).first.roles.first.name == 'Student' %>
<p>您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业,详情如下:</p>
<p><strong>课程:</strong><%= ma.course_message.course.name %>
(<%= ma.course_message.course.term %>)</p>
<p><strong>作业标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<% end %>
<p><strong>作业提交截止日期:</strong><%= ma.course_message.end_time %></p>
<p><strong>匿评自动关闭日期:</strong><%= ma.course_message.homework_detail_manual.evaluation_end %></p>
<p><strong>迟交扣分:</strong><%= ma.course_message.late_penalty %>分</p>
<p>
请同学们抓紧时间提交自己的作品,谢谢!
</p>
<% else %>
<p>您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业,详情如下:</p>
<p><strong>课程:</strong><%= ma.course_message.course.name %>
(<%= ma.course_message.course.term %>)</p>
<p><strong>作业标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<% end %>
<p><strong>作业提交截止日期:</strong><%= ma.course_message.end_time %></p>
<p><strong>匿评自动开始日期:</strong><%= ma.course_message.homework_detail_manual.evaluation_start %></p>
<p><strong>匿评自动关闭日期:</strong><%= ma.course_message.homework_detail_manual.evaluation_end %></p>
<p><strong>迟交扣分:</strong><%= ma.course_message.late_penalty %>分</p>
<p><strong>缺评扣分:</strong><%= ma.course_message.homework_detail_manual.absence_penalty %>分</p>
<p>
您可以修改作业内容、评分规则、匿评过程等,谢谢!
</p>
<% end %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 截止时间快到了!</li>
<% else %>
@ -162,65 +224,89 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--作品开启匿评 待整合:时间紧-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<% if ma.viewed == 0 %>
<li class="homepageHomeworkContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 开启匿评了!</li>
<% else %>
<li class="homepageNewsContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))"%>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--作品开启匿评 待整合:时间紧-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">启动了作业匿评:</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师开启了匿评,作业详情如下:</p>
<p><strong>课程:</strong><%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p><strong>作业标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<% end %>
<p><strong>匿评自动关闭日期:</strong><%= ma.course_message.homework_detail_manual.evaluation_end %>
</p>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--作品关闭匿评-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<% if ma.viewed == 0 %>
<li class="homepageHomeworkContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 匿评已经关闭!</li>
<% else %>
<li class="homepageNewsPubType fl">
<%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">关闭了作业匿评:</span></li>
<li class="homepageNewsContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
<%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))"%>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
<p>您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师关闭了匿评,作业详情如下:</p>
<p><strong>课程:</strong><%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p><strong>作业标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<% end %>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">启动作业匿评失败</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师启动作业匿评失败,作业详情如下:</p>
<p><strong>课程:</strong><%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p><strong>作业标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Poll" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
@ -273,8 +359,24 @@
<% end %>
<% if ma.course_message_type == "StudentWorksScore" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.status == 0 ? "评阅了作品:" : "重新评阅了作品:" %></span></li>
<li class="homepageNewsPortrait fl">
<% if ma.course_message.reviewer_role == 3 %>
<%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
<% else %>
<%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
<% end %>
</li>
<li class="homepageNewsPubType fl">
<% if ma.course_message.reviewer_role == 3 %>
匿名用户
<% else %>
<%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
<% end %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<% unless ma.content.nil? %>
<%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
@ -283,6 +385,13 @@
:onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style" >
<%= ma.content.html_safe %>
<p><strong>课程:</strong><%= ma.course.name %>
(<%= ma.course.term %>)</p>
<p><strong>作业标题:</strong><%=ma.course_message.student_work.homework_common.name %></p>
<% unless ma.course_message.student_work.homework_common.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.student_work.homework_common.description.html_safe %></div>
<% end %>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
@ -314,7 +423,10 @@
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a>
</li>
<li class="homepageNewsPubType fl"><%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
<li class="homepageNewsPubType fl">
<%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
"#{ma.course_message.user.members.where("course_id=?", ma.course.id).first.roles.first.name=='Student'?"同学":"老师"}",
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">回复了作品评论:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -323,7 +435,16 @@
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.notes %>
<div class="fl"><strong>回复内容:</strong></div>
<div class="ml60"><%= ma.course_message.notes %></div>
<div class="fl"><strong>您的作品评论:</strong></div>
<div class="ml80"><%= ma.course_message.jour.comment %></div>
<p><strong>课程:</strong><%= ma.course.name %>(<%= ma.course.term %>)</p>
<p><strong>作业标题:</strong><%=ma.course_message.jour.student_work.homework_common.name %></p>
<% unless ma.course_message.jour.student_work.homework_common.description.blank? %>
<div class="fl"><strong>作业内容:</strong></div>
<div class="ml60"><%= ma.course_message.jour.student_work.homework_common.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -577,7 +698,14 @@
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style" >
<%= ma.journals_for_message.notes.html_safe %>
<% if ma.journals_for_message.reply_id == 0 %>
<%= ma.journals_for_message.notes.html_safe %>
<% else %>
<div class="fl"><strong>您的留言:</strong></div>
<div class="ml60"><%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %></div>
<div class="fl"><strong>回复内容:</strong></div>
<div class="ml60"><%= ma.journals_for_message.notes.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.journals_for_message.created_on).html_safe %> </li>

View File

@ -285,6 +285,7 @@ zh:
label_tags_issue_description: 问题描述
label_tags_project_name: "项目名称:"
label_projects_new_name: "项目名称"
label_tags_project_description: "项目描述"
label_tags_user_mail: "用户邮箱:"

View File

@ -60,6 +60,10 @@ zh:
label_friend_organization: 圈子模式
label_research_group: 研讨模式
label_development_team: 开发模式
label_type_project: 项目类型
label_type_des_development: 开发模式:面向小组开发,支持问题跟踪、代码托管、论坛交流等所有功能。
label_type_des_research: 研讨模式:面向小组研究,支持任务分工、论坛交流、资源分享等。
label_type_des_friend: 圈子模式:面向好友分享,支持论坛交流、资源分享等。
label_member: 成员
project_module_attachments: 资源

View File

@ -101,6 +101,8 @@ RedmineApp::Application.routes.draw do
get 'start_anonymous_comment'
get 'stop_anonymous_comment'
get 'alert_anonymous_comment'
get 'start_evaluation_set'
post 'set_evaluation_attr'
end
collection do
post 'next_step'
@ -221,12 +223,14 @@ RedmineApp::Application.routes.draw do
resources :forums do
collection do
match 'search_forum', :via => [:get, :post]
match 'check_forum_name',:via => [:get]
end
member do
post 'create_memo'
post 'create_feedback'
match 'search_memo', :via => [:get, :post]
match 'delete_forum_tag',:via =>[:get]
match 'add_forum_tag',:via=>[:get]
end
resources :memos do
collection do

View File

@ -0,0 +1,5 @@
class AddReplyIdToMessage < ActiveRecord::Migration
def change
add_column :messages, :reply_id, :integer
end
end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
#coding=utf-8
namespace :homework_evaluation do
desc "start and end evaluation"
def get_assigned_homeworks(student_works, n, index)
student_works += student_works
student_works[index + 1 .. index + n]
end
#自动开启匿评的任务
task :start_evaluation => :environment do
homework_detail_manuals = HomeworkDetailManual.where("evaluation_start = '#{Date.today}'")
homework_detail_manuals.each do |homework_detail_manual|
homework_common = homework_detail_manual.homework_common
if homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
student_works = homework_common.student_works
if student_works && student_works.size >= 2
student_works.each_with_index do |work, index|
user = work.user
n = homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
homework_detail_manual.update_column('comment_status', 2)
# 匿评开启消息邮件通知,# 所有人
course = homework_common.course
course.members.each do |m|
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
# 邮件通知
Mailer.send_mail_anonymous_comment_close(homework_common).deliver
else
#作业数小于2启动失败, 只给老师发
# status==4 发送失败
# 匿评开启消息邮件通知,# 所有人
course = homework_common.course
course.members.each do |m|
if m.user.allowed_to?(:as_teacher,course)
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 4)
end
end
# 邮件通知
# Mailer.send_mail_anonymous_comment_close(homework_common).deliver
end
end
end
end
#自动关闭匿评的任务
task :end_evaluation => :environment do
homework_detail_manuals = HomeworkDetailManual.where("evaluation_end = '#{Date.today}'")
homework_detail_manuals.each do |homework_detail_manual|
homework_common = homework_detail_manual.homework_common
if homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
#计算缺评扣分
work_ids = "(" + homework_common.student_works.map(&:id).join(",") + ")"
homework_common.student_works.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manuals.absence_penalty : 0
student_work.save
end
homework_detail_manual.update_column('comment_status', 3)
# 匿评关闭消息通知 给所有人发
course = homework_common.course
course.members.each do |m|
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
end
# 邮件通知
Mailer.send_mail_anonymous_comment_close(homework_common).deliver
end
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -975,3 +975,14 @@ $(function(){
function new_homework_alert(){
alert("您好!课程内直接发布作业的功能正在改进中,请直接点击\n顶部导航栏的“作业”向本课程发送作业。谢谢如有问\n题可参见帮助中心。");
}
function show_student_work(url){
$.get(
url,
{
},
function (data) {
}
);
}

View File

@ -5,7 +5,7 @@
minStatue : true,
skin : 'blue',
durationTime : 1000
}
};
var options = $.extend(defaults, options);
this.each(function(){
@ -13,17 +13,13 @@
var thisBox = $(this),
closeBtn = thisBox.find('.close_btn' ),
show_btn = thisBox.find('.show_btn' ),
sideContent = thisBox.find('.side_content'),
sideList = thisBox.find('.side_list')
;
sideContent = thisBox.find('.side_content');
var defaultTop = thisBox.offset().top; //????????top
thisBox.css(options.float, 0);
if(options.minStatue == "true"){
$(".show_btn").css("float", options.float);
show_btn.css("float", options.float);
sideContent.css('width', 0);
show_btn.css('width', 25);
}
//close
closeBtn.bind("click",function(){
@ -37,26 +33,12 @@
sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast");
cookiesave('minStatue','false','','','');
});
}); //end this.each
};
})(jQuery);
$(function(){
$("#button1").click(function(){
myTips("<%= l(:label_feedback_success) %>","success");
});
});
function f_submit()
{
// var subject = $("#memo_subject").val();
// var content = $("#memo_content").val();
// $("#memo_subject").val(subject+""+ content.substr(0,18)+"...");
$("#new_memo").submit();
}
@ -68,11 +50,8 @@ function cookiesave(n, v, mins, dn, path)
if(!mins) mins = 365 * 24 * 60;
if(!path) path = "/";
var date = new Date();
date.setTime(date.getTime() + (mins * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
if(dn) dn = "domain=" + dn + "; ";
document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path;
@ -86,34 +65,31 @@ function cookieget(n)
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(name) == 0){
return c.substring(name.length,c.length);}
return c.substring(name.length,c.length);
}
}
return false;
}
$(function(){
$(".closeSidebar").click(function(){
$(".show_btn").css("display","none");
$("#scrollsidebar").css("display","none");
return false;
});
$("#button1").click(function(){
myTips("<%= l(:label_feedback_success) %>","success");
myTips("反馈成功","success");
});
});
$(document).ready(function () {
$(function () {
$("#scrollsidebar").fix({
float: 'right', //default.left or right
minStatue: cookieget('minStatue'),
skin: 'green', //default.gray or blue
durationTime: 600
});
$("#scrollsidebar").fix({
float: 'right', //default.left or right
minStatue: cookieget('minStatue'),
skin: 'green', //default.gray or blue
durationTime: 600
});
});
$(document).ready(function(){
$("#subject").keydown(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
@ -123,8 +99,7 @@ $(document).ready(function(){
else{
$("#textCount").text(50-$("#subject").val().length)
}
})
$("#subject").keyup(function(){
}).keyup(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
@ -133,5 +108,5 @@ $(document).ready(function(){
else{
$("#textCount").text(50-$("#subject").val().length)
}
})
})
});
});

101
public/javascripts/forum.js Normal file
View File

@ -0,0 +1,101 @@
$(function(){
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent().parent('div');
params.div_form = $("div[nhname='div_form']",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='memo[content]']",params.div_form);
//params.textarea.prev('div').css("height","60px");
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form);
params.submit_btn = $("a[nhname='submit_btn']",params.div_form);
params.height = 30;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
toggleAndSettingWordsVal(params.div_form, params.textarea);
});
params.submit_btn.click(function(){
params.form.submit();
});
params.textarea.data('init',1);
}
params.cancel_btn.click();
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
}
},300);
});
$("a[nhname='sub_reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent().parent('div');
params.div_form = $("div[nhname='sub_div_form']",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
//params.textarea.prev('div').css("height","60px");
params.contentmsg = $("p[nhname='sub_contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='sub_toolbar_container']",params.div_form);
params.cancel_btn = $("a[nhname='sub_cancel_btn']",params.div_form);
params.submit_btn = $("a[nhname='sub_submit_btn']",params.div_form);
params.height = 30;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
toggleAndSettingWordsVal(params.div_form, params.textarea);
});
params.submit_btn.click(function(){
params.form.submit();
});
params.textarea.data('init',1);
}
params.cancel_btn.click();
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
}
},300);
});
$("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");
params.submit_btn = $("#new_message_submit_btn");
params.height = 30;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
params.submit_btn.click(function(){
params.form.submit();
});
params.textarea.data('init',1);
$(this).show();
}
});
});
});

View File

@ -153,6 +153,8 @@ $(function(){
language = 'C++';
}else if($('select.language_type').val() == 3){
language = 'Python';
}else if($('select.language_type').val() == 4){
language = 'Java';
}
if (valid) {
@ -199,8 +201,81 @@ $(function(){
program_name = 'text/x-c++src';
}else if(language==3){
program_name = 'text/x-cython';
} else if(language==4){
program_name = 'text/x-java';
}
if ($('#program-src').val().length<=0) {
var src = '';
if(language==4){
src = '\
import java.io.*;\n\
import java.util.*;\n\
\n\
//请一定不要修改类名\n\
class Main\n\
{\n\
public static void main (String args[])\n\
{\n\
//获取参数方式\n\
//Scanner in = new Scanner(System.in);\n\
//int a = in.nextInt();\n\
//int b = in.nextInt();\n\
\n\
//您的代码\n\
}\n\
}\n\
';
}
else if(language==1){
src = '#include <stdio.h>\n\
\n\
int main()\n\
{\n\
//获取参数方式 scanf\n\
//int x =0;\n\
//int y = 0;\n\
//scanf("%d", &x);\n\
\n\
//结果输出使用prinf\n\
//printf("%d",x);\n\
\n\
return 0;\n\
}\n\
';
} else if(language==2){
src = '\
#include <iostream>\n\
using namespace std;\n\
\n\
int main()\n\
{\n\
//获取参数方式 cin\n\
//int x =0;\n\
//cin >> x;\n\
\n\
//结果输出使用 cout\n\
//cout<<"1";\n\
\n\
return 0;\n\
}\n\
';
} else if(language==3){
src = '\
import sys \n\
\n\
#获取参数方式使用raw_input\n\
#input = raw_input()\n\
#a, b = input.split()\n\
\n\
#结果输出使用 print \n\
#print (str(int(a)+int(b)))\n\
';
}
$('#program-src').val(src);
};
var editor = CodeMirror.fromTextArea(document.getElementById("program-src"), {
mode: {name: program_name,
version: 2,

View File

@ -48,7 +48,7 @@ function init_editor(params){
},
afterCreate:function(){
params.submit_btn.hide();
//params.submit_btn.hide();
var toolbar = $("div[class='ke-toolbar']",params.div_form);
toolbar.css('width',24);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');

View File

@ -63,12 +63,12 @@ function submit_homework(id){
else if(!regex_homework_end_time()){
$("#homework_end_time").focus();
}
else if(!regex_evaluation_start()){
$("#evaluation_start_time").focus()
}
else if(!regex_evaluation_end()){
$("#evaluation_end_time").focus()
}
//else if(!regex_evaluation_start()){
// $("#evaluation_start_time").focus()
//}
//else if(!regex_evaluation_end()){
// $("#evaluation_end_time").focus()
//}
else if(!regex_course_id()){
$("#course_id").focus();
}
@ -136,18 +136,36 @@ function search_homework_by_name(url){
);
}
//提交匿评参数设置
function submit_set_evaluation_attr(end_time){
if(!regex_evaluation_start(end_time)){
$("#evaluation_start_time").focus();
}
else if(!regex_evaluation_end()){
$("#evaluation_end_time").focus();
}
else if(!regex_evaluation_num()){
$("#evaluation_num").focus();
}
else{
$('#popbox02 form').submit();
}
}
//验证匿评开启时间:大于截止时间,或者为空
function regex_evaluation_start(){
function regex_evaluation_start(end_time){
var evaluation_start = $.trim($("#evaluation_start_time").val());
if(evaluation_start == ""){
return true;
$("#homework_evaluation_start_time").text("开启匿评日期不能为空");
return false;
}
var end_time = new Date($.trim($("#homework_end_time").val()));
var end_time = new Date(end_time);
var evaluation_start_time = new Date(evaluation_start);
if(evaluation_start_time > end_time){
$("#homework_evaluation_start_time").text("");
return true;
}else{
$("#homework_end_time_span").text("开启匿评日期必须大于截止日期");
$("#homework_evaluation_start_time").text("开启匿评日期必须大于截止日期");
return false;
}
}
@ -157,17 +175,40 @@ function regex_evaluation_end(){
var evaluation_start = $.trim($("#evaluation_start_time").val());
var evaluation_end = $.trim($("#evaluation_end_time").val());
if(evaluation_end == ""){
$("#homework_evaluation_end_time").text("关闭匿评日期不能为空");
return true;
}else if(evaluation_start == ""){
$("#homework_end_time_span").text("开启匿评日期为空时,关闭匿评日期必须为空");
return false;
}
var evaluation_start_time = new Date(evaluation_start);
var evaluation_end_time = new Date(evaluation_end);
if(evaluation_end_time > evaluation_start_time){
$("#homework_evaluation_end_time").text("");
return true;
}else{
$("#homework_end_time_span").text("关闭匿评日期必须大于开启匿评日期");
$("#homework_evaluation_end_time").text("关闭匿评日期必须大于开启匿评日期");
return false;
}
}
//验证匿评数量
function regex_evaluation_num(){
var evaluation_num = $.trim($("#evaluation_num").val());
var regex = /^\d+$/;
if(evaluation_num==""){
$("#evaluation_num_notice").text("匿评人数不能为空");
return false;
}
else if(regex.test(evaluation_num)){
if(evaluation_num > 0){
$("#evaluation_num_notice").html("");
return true;
}
else{
$("#evaluation_num_notice").text("匿评人数必须为大于0");
return false;
}
}
else{
$("#evaluation_num_notice").text("匿评人数只能为数字");
return false;
}
}
@ -295,6 +336,25 @@ var autoTextarea = function (elem, extra, maxHeight) {
change();
};
function limitStrsize(id,length){
document.getElementById(id).onkeydown = function()
{
var n = 0;
var str = this.value;
for (i = 0; i < str.length; i++) {
var leg = str.charCodeAt(i);//ASCII码
if (leg > 255) {//大于255的都是中文
n += 2;//如果是中文就是2个字节
} else {
n += 1;//英文,不多说了
}
}
if(n >= length && event.keyCode !== 8)
event.returnValue = false;
}
}
/////////////////////////////////////////////////////////////////////////////////////创建项目
//验证项目名称是不是为空
function regex_project_name(){

View File

@ -369,6 +369,9 @@ $(document).ready(function () {
$('html, body').animate({scrollTop: $('#' + id).offset().top}, 400);
}
function quote_issue_journal(){
document.getElementById("#issue_notes").focus();
}
/*缺陷完成度决定缺陷状态*/
function PrecentChange(obj) {
@ -503,3 +506,4 @@ function judgeprojectname(){
function submitProjectFeedback() {
$("#project_feedback_form").submit();
}

View File

@ -613,7 +613,7 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px
.vi_zan{color:#28be6c;}
.newwork_btn a{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; display:block; text-align:center; float:right;}
.newwork_btn a:hover{ background:#329cbd;}
.files_tag{ width:670px; height:22px; overflow:hidden; margin-bottom:10px;}
.files_tag{ width:670px; min-height:22px;margin-bottom:10px;}/* overflow:hidden; */
a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; }
a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;}

View File

@ -55,7 +55,7 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;}
.homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;}
.homepageLabelText {color:#484848; font-size:16px; margin-left:10px; margin-bottom:12px; display:block;}
.homepageRightBanner {width:720px; height:34px; margin:0px auto; border-bottom:1px solid #e9e9e9;}
.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; background:url(../images/homepage_icon.png) -18px -230px no-repeat; width:150px; float:left; padding-left:15px; margin-top:4px;}
.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; width:150px; float:left; margin-top:4px;}
.newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2; z-index:9999;}
.newsReadSetting {width:700px; background-color:#f6f6f6; border-bottom:1px solid #eeeeee; margin:10px auto; height:39px; line-height:39px; vertical-align:middle; font-size:14px; color:#7a7a7a; padding-left:10px;}
.homepageNewsList {width:710px; height:49px; line-height:49px; vertical-align:middle; border-bottom:1px dashed #eaeaea; margin-left:10px;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

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