Merge branch 'develop' into cxt_course

This commit is contained in:
cxt 2016-10-20 15:31:44 +08:00
commit a9d4b45bff
190 changed files with 2374 additions and 1711 deletions

View File

@ -112,7 +112,7 @@ module Mobile
# end
if reply_type == nil || reply_type == 0
homework_common = HomeworkCommon.find(params[:id])
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id], params[:id])
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
@ -124,7 +124,7 @@ module Mobile
homework_common = HomeworkCommon.find reply.jour_id
options = {:notes => params[:content], :reply_id => reply.user_id,:user_id => current_user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, options)
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, reply.jour_id, options)
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
@ -189,6 +189,7 @@ module Mobile
reply.content = params[:content]
reply.parent_id = params[:id]
reply.subject = "RE: #{topic.subject}"
reply.root_id = topic.id
if message.children << reply
result = 2
update_id = topic.id
@ -224,6 +225,7 @@ module Mobile
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:root_id => jour.id,
:notes => content,
:is_readed => false}
jfm = jour.user.add_jour(nil, nil, nil, options)
@ -278,6 +280,7 @@ module Mobile
blogComment.blog = blog.blog
blogComment.content = params[:content]
blogComment.title = "RE: #{blog.title}"
blogComment.root_id = blog.id
if blog.children << blogComment
result = 2
update_id = blog.id
@ -293,6 +296,7 @@ module Mobile
parent = BlogComment.find params[:id]
blogComment.parent_id = params[:id] #被回复的回复
blogComment.reply_id = parent.author.id #被回复者id
blogComment.root_id = blog.id
if parent.children << blogComment
result = 2

View File

@ -25,8 +25,10 @@ module Mobile
elsif ac.act_type == "News"
ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count
elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
all_comments = []
ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
className = ac.act_type.classify.constantize
# all_comments = []
# ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
ac.nil? || ac.act.nil? ? 0 : className.where("root_id = #{ac.act.id}").count
elsif ac.act_type == "Issue"
ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
end

View File

@ -31,6 +31,7 @@ class AdminController < ApplicationController
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
end
# 管理员界面 项目列表
def projects
=begin
@status = params[:status] || 1
@ -39,7 +40,16 @@ class AdminController < ApplicationController
scope = scope.like(params[:name]) if params[:name].present?
@projects = scope.where(project_type: Project::ProjectType_project).reorder("created_on desc").all
=end
@projects = Project.like(@name).order('created_on desc')
# 搜索功能
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@status = params[:status] || ""
unless @status.empty?
@projects = Project.where(:status=>@status).like(condition).order('created_on desc')
else
@projects = Project.like(condition).order('created_on desc')
end
# 分页
@projects = paginateHelper @projects,30
@page = (params['page'] || 1).to_i - 1
render :action => "projects", :layout => false if request.xhr?

View File

@ -46,6 +46,13 @@ class ArticleHomepagesController < ApplicationController
if User.current.logged?
@article.title = params[:article_homepage][:title]
@article.content = params[:article_homepage][:content]
if params[:set_homepage]
User.current.homepage.update_attribute(:article_id, @article.id)
else
if User.current.homepage.article_id == @article.id
User.current.homepage.update_attribute(:article_id, nil)
end
end
if @article.save
redirect_to user_homepages_path(:user_id => User.current.id)
end

View File

@ -329,7 +329,31 @@ class AttachmentsController < ApplicationController
end
end
# prams[:type] => history 历史版本
def destroy
if params[:type] == "history"
begin
AttachmentHistory.find(params[:history_id]).destroy
@attachment = Attachment.find(params[:id])
@is_history = true
@is_history_destroy = false
@attachment_histories = @attachment.attachment_histories
rescue Exception => e
puts e
end
elsif params[:type] == "history_delete"
begin
AttachmentHistory.find(params[:history_id]).destroy
@attachment = Attachment.find(params[:id])
@is_history_delete = true
@is_history_destroy = false
@attachment_histories = @attachment.attachment_histories
@attachment_histories_count = @attachment_histories.count
rescue Exception => e
puts e
end
else
@history = params[:history]
if @attachment.container.respond_to?(:init_journal)
@attachment.container.init_journal(User.current)
end
@ -342,6 +366,8 @@ class AttachmentsController < ApplicationController
else
@attachment.destroy
end
end
respond_to do |format|
if !@attachment.container.nil? &&
@ -631,6 +657,7 @@ class AttachmentsController < ApplicationController
#找到文件的所有的历史版本
def attachment_versions
@history = params[:history]
@attachment = Attachment.find(params[:id])
@attachment_histories = @attachment.attachment_histories
respond_to do |format|
@ -638,6 +665,15 @@ class AttachmentsController < ApplicationController
end
end
def attachment_versions_delete
@attachment = Attachment.find(params[:id])
@attachment_histories = @attachment.attachment_histories
@attachment_histories_count = @attachment_histories.count
respond_to do |format|
format.js
end
end
#找到文件的所有的历史版本及当前版本
def attachment_history_download
@attachment = Attachment.find(params[:id])

View File

@ -152,10 +152,12 @@ class BlogCommentsController < ApplicationController
@blogComment.content = params[:blog_comment][:content]
parent = BlogComment.find params[:parent_id]
@blogComment.reply_id = params[:id]
@blogComment.root_id = parent.root_id.nil? ? parent.id : parent.root_id
parent.children << @blogComment
else
@quote = params[:quote][:quote] || ""
@blogComment.content = @quote + @blogComment.content
@blogComment.root_id = @article.id
@article.children << @blogComment
end
@article.save

View File

@ -130,7 +130,8 @@ class BoardsController < ApplicationController
@type = 2
@topics.each do |topic|
all_comments = []
count=get_all_children(all_comments, topic).count
#count=get_all_children(all_comments, topic).count
count=Message.where("root_id = #{topic.id}").count
topic[:infocount] = get_praise_num(topic) + count
if topic[:infocount] < 0
topic[:infocount] = 0

View File

@ -26,7 +26,7 @@ class FilesController < ApplicationController
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description]
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description, :edit_file_description]
helper :sort
include SortHelper
@ -981,6 +981,13 @@ class FilesController < ApplicationController
def upload_files_menu
end
def edit_file_description
@attachment = Attachment.find(params[:id])
@attachment.description = params[:file_description_edit]
@attachment.save
end
def update_file_description
@attachment = Attachment.find(params[:id])
@attachment.description = params[:description]

View File

@ -6,7 +6,12 @@ class HomepagesController < ApplicationController
@b_sort = params[:sort] || 1
@b_sort = @b_sort.to_i == 1 ? 2 : 1
sort_type = @b_sort == 1 ? "asc" : "desc"
if @user.base_homepage.nil?
@articles = @user.homepage.article_homepages.reorder("updated_at #{sort_type}")
else
@articles = @user.homepage.article_homepages.where("id != #{@user.base_homepage.id}").reorder("updated_at #{sort_type}").all
@articles.insert(0, @user.base_homepage) unless @user.base_homepage.nil?
end
@limit = 20
@is_remote = true
@atta_count = @articles.count
@ -30,39 +35,25 @@ class HomepagesController < ApplicationController
def set_homepage
@homepage = Homepage.find(params[:id])
@homepage.update_attribute(:article_id, params[:article_id])
if @user.base_homepage.nil?
@articles = @user.homepage.article_homepages.reorder("updated_at desc")
@limit = 20
@is_remote = true
@atta_count = @articles.count
@atta_pages = Paginator.new @atta_count, @limit, 1
@articles = paginateHelper @articles,@limit
if params[:show]
redirect_to homepage_user_path(@user.id)
return
else
respond_to do |format|
format.js
end
@articles = @user.homepage.article_homepages.where("id != #{@user.base_homepage.id}").reorder("updated_at desc").all
@articles.insert(0, @user.base_homepage) unless @user.base_homepage.nil?
end
redirect_to user_homepages_path(:user_id => @user.id)
end
def cancel_homepage
@homepage = Homepage.find(params[:id])
@homepage.update_attribute(:article_id, nil)
if @user.base_homepage.nil?
@articles = @user.homepage.article_homepages.reorder("updated_at desc")
@limit = 20
@is_remote = true
@atta_count = @articles.count
@atta_pages = Paginator.new @atta_count, @limit, 1
@articles = paginateHelper @articles,@limit
if params[:show]
redirect_to user_homepage_article_homepage_path(:user_id=>@user.id, :homepage_id=>@homepage.id,:id=>params[:article_id].to_i)
return
else
respond_to do |format|
format.js
end
@articles = @user.homepage.article_homepages.where("id != #{@user.base_homepage.id}").reorder("updated_at desc").all
@articles.insert(0, @user.base_homepage) unless @user.base_homepage.nil?
end
redirect_to user_homepages_path(:user_id => @user.id)
end
private

View File

@ -146,7 +146,7 @@ class HomeworkCommonController < ApplicationController
@homework_detail_group = @homework.homework_detail_group
@homework_detail_group.min_num = params[:min_num].to_i if params[:min_num]
@homework_detail_group.max_num = params[:max_num].to_i if params[:max_num]
@homework_detail_group.base_on_project = params[:base_on_project].to_i if params[:base_on_project]
@homework_detail_group.base_on_project = params[:base_on_project] ? 1 : 0
end
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
@ -202,24 +202,24 @@ class HomeworkCommonController < ApplicationController
if @homework_detail_manual.comment_status == 1
student_works = @homework.student_works.has_committed
if student_works && student_works.size >= 2
if @homework.homework_type == 3
student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
student_work_projects.each_with_index do |pro_work, pro_index|
n = @homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
work_index = -1
student_works.each_with_index do |stu_work, stu_index|
if stu_work.id.to_i == pro_work.student_work_id.to_i
work_index = stu_index
end
end
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
else
# if @homework.homework_type == 3
# student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
# student_work_projects.each_with_index do |pro_work, pro_index|
# n = @homework_detail_manual.evaluation_num
# n = n < student_works.size ? n : student_works.size - 1
# work_index = -1
# student_works.each_with_index do |stu_work, stu_index|
# if stu_work.id.to_i == pro_work.student_work_id.to_i
# work_index = stu_index
# end
# end
# assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
# assigned_homeworks.each do |h|
# student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
# student_works_evaluation_distributions.save
# end
# end
# else
student_works.each_with_index do |work, index|
user = work.user
n = @homework_detail_manual.evaluation_num
@ -230,7 +230,7 @@ class HomeworkCommonController < ApplicationController
student_works_evaluation_distributions.save
end
end
end
#end
@homework_detail_manual.update_column('comment_status', 2)
@homework_detail_manual.update_column('evaluation_start', Date.today)
@statue = 1
@ -255,11 +255,28 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.update_column('evaluation_end', Date.today)
#计算缺评扣分
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
if @homework.homework_type != 3
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
else
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
if student_work.absence_penalty != 0
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = @homework.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
st_work.update_attribute("absence_penalty", student_work.absence_penalty)
end
end
end
end
# 匿评关闭消息邮件通知
send_message_anonymous_comment(@homework, m_status = 3)
Mailer.send_mail_anonymous_comment_close(@homework).deliver

View File

@ -45,7 +45,7 @@ class MessagesController < ApplicationController
# page = 1 + offset / REPLIES_PER_PAGE
# end
all_comments = []
@replies = get_all_children(all_comments, @topic)
@replies = Message.where("root_id = #{@topic.id}").reorder("created_on desc")
@reply_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@ -165,6 +165,7 @@ class MessagesController < ApplicationController
@reply.content = params[:content]
@reply.subject = "RE: #{@topic.subject}"
@reply.reply_id = params[:id]
@reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id
# @reply.reply_id = params[:id]
parent.children << @reply
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@ -178,6 +179,7 @@ class MessagesController < ApplicationController
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@reply.root_id = @topic.id
@topic.children << @reply
# @reply.reply_id = params[:id]
end

View File

@ -96,6 +96,7 @@ class OrgDocumentCommentsController < ApplicationController
@act = OrgActivity.find(params[:act_id])
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:org_content]
@comment.root_id = @document.id
@document.children << @comment
@document.save
end
@ -109,6 +110,7 @@ class OrgDocumentCommentsController < ApplicationController
@comment.content = params[:org_comment][:org_content]
end
@comment.root_id = @document.id
@document.children << @comment
@document.save
respond_to do |format|
@ -168,6 +170,7 @@ class OrgDocumentCommentsController < ApplicationController
@org_document.title = params[:org_document_comment][:title]
@org_document.content = params[:org_document_comment][:content]
@org_document.root_id = @document.root_id.nil? ? @document.id : @document.root_id
@document.children << @org_document
@document = @document.root

View File

@ -460,6 +460,16 @@ class OrganizationsController < ApplicationController
@members = paginateHelper @members, 20
end
def more_org_submains
@org_subfield = OrgSubfield.find params[:org_subfield_id].to_i
@page = params[:page]
@submains = @org_subfield.sub_domains.reorder('priority').uniq.page((params[:page].to_i || 1) +1).per(5)
respond_to do |format|
format.js
end
end
def more_org_projects
@organization = Organization.find params[:id]
@page = params[:page]

View File

@ -1,10 +1,10 @@
#encoding utf-8
class PollController < ApplicationController
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll,:save_poll]
before_filter :find_container, :only => [:new,:create, :index]
before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result]
before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result,:save_poll]
before_filter :is_member_of_course, :only => [:index,:show,:poll_result]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:save_poll]
include PollHelper
def index
if @course
@ -245,7 +245,7 @@ class PollController < ApplicationController
def publish_poll
@poll.polls_status = 2
@poll.published_at = Time.now
@poll.show_result = params[:show_result]
@poll.show_result = params[:show_result].to_i if params[:show_result]
if @poll.save
if params[:is_remote]
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
@ -257,6 +257,16 @@ class PollController < ApplicationController
end
end
#保存问卷
def save_poll
@poll.show_result = params[:show_result].to_i
if @poll.save
respond_to do |format|
format.js
end
end
end
#提交答案
def commit_answer
pq = PollQuestion.find(params[:poll_question_id])
@ -695,7 +705,7 @@ class PollController < ApplicationController
sheet1[count_row + 1,0] = l(:label_poll_subtotal)
sheet1[count_row + 2,0] = l(:label_poll_proportion)
poll_question.poll_answers.each_with_index do |poll_answer,i|
sheet1[count_row, i + 1] = poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
sheet1[count_row, i + 1] = poll_answer.answer_text == "" ? l(:label_poll_other) : poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
sheet1[count_row + 1, i + 1] = poll_answer.poll_votes.count
sheet1[count_row + 2, i + 1] = statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)).to_s + "%"
end
@ -707,27 +717,58 @@ class PollController < ApplicationController
sheet1[count_row,0] = l(:label_poll_question_num,:num => poll_question.question_number)
sheet1[count_row,1] = poll_question.question_title
count_row += 1
if poll_question.question_type == 3
poll_question.poll_votes.each do |poll_vote|
sheet1[count_row,0] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
count_row += 1
end
count_row += 1
else
count = 0
poll_question.poll_answers.reorder("answer_position asc").each_with_index do |poll_answer,i|
sheet1.row(count_row).default_format = blue
sheet1[count_row, i] = poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
count = poll_question.poll_votes.where("poll_answer_id = #{poll_answer.id}").count > count ? poll_question.poll_votes.where("poll_answer_id = #{poll_answer.id}").count : count
poll_question.poll_votes.where("poll_answer_id = #{poll_answer.id}").each_with_index do |poll_vote, j|
sheet1[count_row + j + 1,i] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
end
end
count_row = count_row + count + 2
end
end
end
sheet1.row(count_row).default_format = blue
sheet1[count_row ,0] = l(:label_bidding_user_studentname)
poll_questions.each_with_index do |poll_question, i|
sheet1[count_row ,i + 1] = poll_question.question_title
current_index = 1
poll_questions.each do |poll_question|
if poll_question.question_type == 4
poll_question.poll_answers.reorder("answer_position asc").each do |ans|
sheet1[count_row ,current_index] = poll_question.question_title + "(#{ans.answer_text})"
current_index += 1
end
else
sheet1[count_row ,current_index] = poll_question.question_title
current_index += 1
end
end
count_row += 1
@poll.users.each do |user|
sheet1[count_row ,0] = user.show_name
current_index = 1
poll_questions.each_with_index do |poll_question, i|
if poll_question.question_type == 1 || poll_question.question_type == 2
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ") if poll_vote.poll_answer}.join(";")
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ") if poll_vote.poll_answer}.join(";")
current_index += 1
elsif poll_question.question_type == 3
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")}.join(";")
current_index += 1
else
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")}.join(";")
poll_question.poll_answers.reorder("answer_position asc").each do |ans|
poll_vote = user.poll_votes.where(:poll_question_id => poll_question.id, :poll_answer_id => ans.id).first
sheet1[count_row ,current_index] = poll_vote.nil? ? "" : poll_vote.vote_text
current_index += 1
end
end
end
count_row += 1

View File

@ -190,7 +190,7 @@ class StudentWorkController < ApplicationController
status = student_work_test.status
resultObj[:testid] = student_work_test.id
end
student_work.save
#超时或编译错误则直接返回了并存入数据库
if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size
if status == 0

View File

@ -102,7 +102,7 @@ class SubDocumentCommentsController < ApplicationController
@subdomain = @document.sub_domain
@org_subfield = @subdomain.org_subfield
@organization = @org_subfield.organization
@act = OrgActivity.find(params[:id])
@act = OrgActivity.find(params[:act_id])
@comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:sub_content]
@document.children << @comment

View File

@ -1063,9 +1063,9 @@ class UsersController < ApplicationController
homework_detail_manual = HomeworkDetailManual.new
if homework.anonymous_comment == 1
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 1.0 : 0.4
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.4 : 1.0
else
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.3 : 0.6
end
if homework.publish_time > Date.today
homework_detail_manual.comment_status = 0
@ -3056,7 +3056,7 @@ class UsersController < ApplicationController
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
# user_org_ids = User.current.organizations.map {|o| o.id}
if( params[:type] == "1") # 我的资源
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
@ -3070,7 +3070,7 @@ class UsersController < ApplicationController
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
elsif (params[:type].blank? || params[:type] == "6") # 公共资源
elsif (params[:type] == "6") # 公共资源
if params[:status] == "2"
@attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
@ -3200,6 +3200,7 @@ class UsersController < ApplicationController
ori = Attachment.find_by_id(send_id)
# 如果该附件已经存课程中,则只更新附件创建时间
mul_container.attachments.each do |att|
@exist = false
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@ -3526,19 +3527,19 @@ class UsersController < ApplicationController
if params[:type].present?
case params[:type]
when 'OrgDocumentComment'
obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
#obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@type = 'OrgDocumentComment'
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = OrgDocumentComment.where("root_id = #{params[:id].to_i}").reorder("created_at desc")
when 'Message'
obj = Message.where('id = ?', params[:id].to_i).first
#obj = Message.where('id = ?', params[:id].to_i).first
@type = 'Message'
@is_course = params[:is_course]
@is_board = params[:is_board]
@user_activity_id = params[:div_id].to_i if params[:div_id]
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = Message.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'News'
obj = News.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")
@ -3550,9 +3551,9 @@ class UsersController < ApplicationController
@type = 'Syllabus'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'JournalsForMessage'
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
journals = []
@journals = get_all_children(journals, obj)
#obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
#journals = []
@journals = JournalsForMessage.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
@type = 'JournalsForMessage'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'Issue'
@ -3566,8 +3567,8 @@ class UsersController < ApplicationController
@homepage = params[:homepage].to_i
@type = 'BlogComment'
@user_id = obj.author_id
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = BlogComment.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'HomeworkCommon'
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
@type = 'HomeworkCommon'
@ -3580,13 +3581,11 @@ class UsersController < ApplicationController
end
def homepage
if @user.base_homepage
@article = @user.base_homepage
respond_to do |format|
format.html {render :layout => 'clear_base'}
end
end
end
private

View File

@ -153,72 +153,10 @@ class WelcomeController < ApplicationController
def search
@name = params[:q]
@search_type = params[:search_type]
case params[:search_type]
when 'all'
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
when 'user'
@users = User.search(@name).page(params[:page] || 1).per(20)
when 'project'
@projects = Project.search(@name).page(params[:page] || 1).per(20).results
when 'course'
@courses = Course.search(@name).page(params[:page] || 1).per(20).results
when 'attachment'
@attachments = Attachment.search(@name).page(params[:page] || 1).per(20).results
when 'memo'
@memos = Memo.search(@name).page(params[:page] || 1).per(20).results
else
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
end
page = (params[:page] || 1).to_i
@users_count = User.search(@name).results.total
@syllabus_count = Syllabus.search(@name).results.total
@course_count = Course.search(@name).results.total
@attach_count = Attachment.search(@name).results.total
@project_count = Project.search(@name).results.total
@ -229,7 +167,7 @@ class WelcomeController < ApplicationController
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
@ -239,6 +177,7 @@ class WelcomeController < ApplicationController
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
@ -246,7 +185,110 @@ class WelcomeController < ApplicationController
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).results.total
},[User,Syllabus,Course,Attachment,Project,Memo] ).results.total
case params[:search_type]
when 'all'
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
when 'user'
if (page-1)*20 >= @users_count
page = 1
params[:page] = "1"
end
@users = User.search(@name).page(page).per(20)
when 'syllabus'
if (page-1)*20 >= @syllabus_count
page = 1
params[:page] = "1"
end
@syllabuses = Syllabus.search(@name).page(page).per(20).results
when 'project'
if (page-1)*20 >= @project_count
page = 1
end
@projects = Project.search(@name).page(page).per(20).results
when 'course'
if (page-1)*20 >= @course_count
page = 1
params[:page] = "1"
end
@courses = Course.search(@name).page(page).per(20).results
when 'attachment'
if (page-1)*20 >= @attach_count
page = 1
params[:page] = "1"
end
@attachments = Attachment.search(@name).page(page).per(20).results
when 'memo'
if (page-1)*20 >= @memo_count
page = 1
params[:page] = "1"
end
@memos = Memo.search(@name).page(page).per(20).results
else
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
end
# search_type = params[:search_type].to_sym unless search_condition.blank?
# search_by = params[:search_by]
#

View File

@ -41,6 +41,7 @@ class WordsController < ApplicationController
# 删除留言功能要调用destroy也记得在destroy.js中修改
# deny api. api useless
parent = JournalsForMessage.find params[:reference_id].to_i
parent_id = params[:reference_id]
author_id = User.current.id
reply_user_id = params[:reference_user_id]
@ -53,6 +54,7 @@ class WordsController < ApplicationController
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:root_id => parent.root_id.nil? ? parent.id : parent.root_id,
:is_readed => false}
@activity = params[:activity_id].nil? ? JournalsForMessage.find(parent_id) : JournalsForMessage.find(params[:activity_id].to_i)
@jfm = add_reply_adapter(@activity, options)
@ -274,7 +276,7 @@ class WordsController < ApplicationController
@user = User.current
@syllabus = Syllabus.find(params[:id]);
if params[:comment].size>0 && User.current.logged? && @user
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id])
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id], @syllabus.id)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -296,7 +298,7 @@ class WordsController < ApplicationController
@user = User.current
@homework_common = HomeworkCommon.find(params[:id]);
if params[:homework_message].size>0 && User.current.logged? && @user
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id])
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id], @homework_common.id)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -329,8 +331,8 @@ class WordsController < ApplicationController
reply = JournalsForMessage.find params[:id].to_i
@homework_common = HomeworkCommon.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, options)
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, reply.root_id, options)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -363,8 +365,8 @@ class WordsController < ApplicationController
reply = JournalsForMessage.find params[:id].to_i
@syllabus = Syllabus.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, reply.root_id, options)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')

View File

@ -56,6 +56,14 @@ module ApplicationHelper
user.nil? ? User.find(2) : user
end
# 重置user_path目的是将id转换成用户名
# def user_path(resource, parameters = {})
# if Fixnum === resource
# resource = User.find(resource)
# end
# super
# end
# 历史数据(老版本库数据)处理完则可以修改该放放
def get_rep_identifier_by_project project
identifier = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
@ -1380,6 +1388,21 @@ module ApplicationHelper
end
end
# 判断课程、项目、组织是否有权限删除历史资源
# 项目管理员或者附件的作者可以删除
# (is_project_manager?(User.current.id, @project.id) || User.current.id == history.author_id)
def allow_to_delete_attachment history
attachment = history.attachment
case attachment.try(:container_type)
when "Project"
result = is_project_manager?(User.current.id, attachment.container_id) || User.current.id == history.author_id || User.current.admin?
when "Course"
result = User.current.allowed_to?(:as_teacher, attachment.container) || User.current.id == history.author_id || User.current.admin?
when "OrgSubfield"
result = User.current.id == history.author_id || User.current.admin_of_org?(attachment.container) || User.current.admin?
end
end
# Wiki links
#
# Examples:
@ -1423,7 +1446,7 @@ module ApplicationHelper
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
end
end
link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
link_to(title.present? ? title.html_safe : h(page), User.current.logged? ? url : signin_url_without_domain, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
else
# project or wiki doesn't exist
all
@ -2280,6 +2303,8 @@ module ApplicationHelper
candown = true
elsif attachment.container.class.to_s=="Memo" #论坛资源允许下载
candown = true
elsif attachment.container.class.to_s=="Syllabus" #论坛资源允许下载
candown = true
elsif attachment.container.class.to_s == "User"
candown = (attachment.is_public == 1 || attachment.is_public == true || attachment.author_id == User.current.id)
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
@ -2829,7 +2854,7 @@ module ApplicationHelper
link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 && work.user_id == User.current.id #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
@ -2948,7 +2973,7 @@ module ApplicationHelper
def file_preview_eye(file, html_options={})
if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)}
link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options
link_to '', User.current.logged? ? download_named_attachment_path(file.id, file.filename, preview: true) : signin_url_without_domain, html_options
end
end

View File

@ -791,7 +791,11 @@ module CoursesHelper
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "sy_btn_grey fl")
end
else
if User.current.logged?
link = "<a href='javascript:void(0)' class='sy_btn_grey fl ml10' >#{l(:label_course_join_student)}</a>"
else
link = link_to(l(:label_course_join_student), signin_url_without_domain, :class => "sy_btn_grey fl ml10")
end
end
link.html_safe
end

View File

@ -41,7 +41,7 @@ class Attachment < ActiveRecord::Base
validates :filename, presence: true, length: {maximum: 254}
validates :author, presence: true
validates :disk_filename, length: {maximum: 254}
validates :description, length: {maximum: 254}
# validates :description, length: {maximum: 254}
validate :validate_max_file_size
#elasticsearch
@ -369,6 +369,7 @@ class Attachment < ActiveRecord::Base
# 有了历史记录的数据记录是不能被删除的。
# true 能被删除 false 不能被删除
# 2016.10.14 修改成可以删除,删除时候添加提示全部删除
def destroyable
self.attachment_histories.count == 0
end

View File

@ -19,7 +19,7 @@ class BlogComment < ActiveRecord::Base
validates_presence_of :title, :content
validates_length_of :title, :maximum => 255
#validate :cannot_reply_to_locked_comment, :on => :create
safe_attributes 'title', 'content',"sticky", "locked"
safe_attributes 'title', 'content',"sticky", "locked", "root_id"
after_save :add_user_activity
after_update :update_activity

View File

@ -24,7 +24,7 @@ class Course < ActiveRecord::Base
end
end
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
@ -96,7 +96,9 @@ class Course < ActiveRecord::Base
'class_period',
'open_student',
'is_delete',
'syllabus_id'
'syllabus_id',
'end_time',
'end_term'
acts_as_customizable

View File

@ -113,10 +113,10 @@ class HomeworkCommon < ActiveRecord::Base
end
###添加回复
def self.add_homework_jour(user, notes, id , options = {})
def self.add_homework_jour(user, notes, id, root_id, options = {})
homework = HomeworkCommon.find(id)
if options.count == 0
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
else
jfm = homework.journals_for_messages.build(options)
end

View File

@ -19,7 +19,8 @@ class JournalsForMessage < ActiveRecord::Base
"m_reply_count", # 留言的回复数量
"m_reply_id" , # 回复某留言的留言id(a留言回复了b留言这是b留言的id)
"is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言
"private"
"private",
"root_id"
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
after_destroy :delete_kindeditor_assets
belongs_to :project,

View File

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

View File

@ -1,6 +1,6 @@
class OrgDocumentComment < ActiveRecord::Base
# status: 1 模式二中置顶 0模式二中正常显示
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status, :root_id
include Redmine::SafeAttributes
include ApplicationHelper
belongs_to :organization

View File

@ -2,6 +2,18 @@
class Syllabus < ActiveRecord::Base
include Redmine::SafeAttributes
include ApplicationHelper
#elasticsearch
include Elasticsearch::Model
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :title, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_at, index:"not_analyzed", type:'date'
end
end
acts_as_taggable
acts_as_attachable
has_many_kindeditor_assets :assets, :dependent => :destroy
@ -17,6 +29,12 @@ class Syllabus < ActiveRecord::Base
validates :title, :user_id, presence: true
after_update :update_syllabus_ealasticsearch_index
after_create :create_syllabus_ealasticsearch_index
before_destroy :delete_syllabus_ealasticsearch_index
scope :indexable,lambda { where(nil) }#用于elastic建索引的scope
scope :like, lambda {|arg|
if arg.blank?
where(nil)
@ -47,14 +65,65 @@ class Syllabus < ActiveRecord::Base
end
###添加回复
def self.add_syllabus_jour(user, notes, id , options = {})
def self.add_syllabus_jour(user, notes, id, root_id, options = {})
syllabus = Syllabus.find(id)
if options.count == 0
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
else
jfm = syllabus.journals_for_messages.build(options)
end
jfm.save
jfm
end
def create_syllabus_ealasticsearch_index
return if Rails.env.development?
self.__elasticsearch__.index_document
end
def update_syllabus_ealasticsearch_index
return if Rails.env.development?
begin
self.__elasticsearch__.update_document
rescue => e
self.__elasticsearch__.index_document
end
end
def delete_syllabus_ealasticsearch_index
return if Rails.env.development?
begin
self.__elasticsearch__.delete_document
rescue => e
end
end
def self.search(query)
__elasticsearch__.search(
{
query: {
multi_match: {
query: query,
type:"most_fields",
operator: "or",
fields: ['title']
}
},
sort: {
_score:{order: "desc" },
updated_at:{order:"desc"}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
title: {},
description: {}
}
}
}
)
end
end

View File

@ -320,6 +320,12 @@ class User < Principal
self.user_extensions.try(:occupation).to_s
end
# id 转换成 登录名
# def to_param
# self.login.to_i > 0 ? id : login
# end
def my_blogs_count
self.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count
end
@ -453,6 +459,12 @@ class User < Principal
name = lastname + firstname
name.empty? || name.nil? ? login : name
end
def show_occupation
if self.user_extensions && self.user_extensions.school
self.user_extensions.school.name
end
end
## end
def get_at_show_name

View File

@ -418,7 +418,7 @@ class CoursesService
course.send(:safe_attributes=, params[:course], current_user)
#course.safe_attributes = params[:course]
#course.password = params[:course][:password]
course.syllabus_id = params[:syllabus_id].to_i
#course.syllabus_id = params[:syllabus_id].to_i
course.time = params[:time]
course.term = params[:term]
course.end_time = params[:end_time]

View File

@ -38,11 +38,13 @@
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.name%>'>
<%=link_to(homework.try(:name), student_work_index_path(:homework => homework.id))%>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%= homework.course.nil? ? "" : homework.course.name %>'>
<% if homework.course %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.course.name%>'>
<%= link_to(homework.course.name, course_path(homework.course.id)) %>
</td>
<%= link_to homework.course.name, course_path(homework.course.id) %>
<% end %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
<% if homework.try(:user).try(:realname) == ' '%>
<%= link_to(homework.try(:user), user_path(homework.user_id)) %>

View File

@ -18,7 +18,7 @@
<label for='name'>
<%= l(:label_project) %>:
</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '输入项目名称进行搜索' %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>

View File

@ -17,7 +17,7 @@
:owner_id => @article.nil? ? 0: @article.id,
:owner_type => OwnerTypeHelper::ArticleHomepage,
:width => '100%',
:height => 500,
:height => 418,
:minHeight=>500,
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
@ -28,12 +28,10 @@
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>
</div>
<% unless is_edit %>
<div class="mt10">
<input type="checkbox" value="1" id="set_homepage" name="set_homepage"/>
<label for="set_homepage">设为主页</label>
</div>
<% end %>
<div class="cl"></div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_article();">确定</a>
@ -47,4 +45,9 @@
function reset_article(){
window.location.href = "<%=user_homepages_path(:user_id => User.current.id) %>";
}
$(function() {
<% if is_edit && @article.homepage.article_id == @article.id %>
$("#set_homepage").attr('checked',true);
<% end %>
});
</script>

View File

@ -1,54 +1,54 @@
<div class="homepageContentContainer" style="margin-top: 25px;">
<div class="homepageContent">
<div class="postContainer mb10 pr">
<% if User.current && User.current == @article.user %>
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="top: -25px;">
<div class="homepageMainContent">
<div class="postRightContainer pr" style="padding: 25px 40px;">
<% if User.current == @user %>
<div class="homepagePostSetting" style="top: -25px;">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<% if @article.id == @article.homepage.article_id %>
<%= link_to(
l(:button_cancel_base_homepage),
{:controller => 'homepages',:action => 'cancel_homepage',:user_id=>@article.user_id,:id=>@article.homepage_id, :article_id => @article.id, :show => 1},
:method => :post,
:class => 'postOptionLink'
)%>
<% else %>
<%= link_to(
l(:button_set_base_homepage),
{:controller => 'homepages',:action => 'set_homepage',:user_id=>@article.user_id,:id=>@article.homepage_id, :article_id => @article.id, :show => 1},
:method => :post,
:class => 'postOptionLink'
) %>
<% end %>
</li>
<li>
<%= link_to(
l(:button_edit),
{:controller => 'article_homepages',:action => 'edit', :id => @article.id},
:class => 'postOptionLink'
) %>
</li>
<li>
<%= link_to(
l(:button_delete),
{:controller => 'article_homepages',:action => 'destroy', :id => @article.id},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) %>
<%= link_to(l(:button_conf_base_homepage), user_homepages_path(:user_id=>@user.id), :class => 'postOptionLink' )%>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<% if @article.nil? %>
<% if User.current == @user && @user.homepage.article_homepages.empty? %>
<p class="nodata mt10" style="text-align: left;">您还没有创建属于自己的个人主页。<%=link_to '新建', new_user_homepage_article_homepage_path(:user_id=> @user.id, :homepage_id => @user.homepage.id), :target => "_blank", :class => 'linkBlue' %></p>
<% elsif User.current == @user %>
<p class="nodata mt10 mb0" style="text-align: left;">您还没有设置个人主页,其他用户无法查看哦</p>
<% else %>
<p class="nodata mt10 mb0" style="text-align: left;">该用户还未设置个人主页</p>
<% end %>
<% else %>
<div class="cl"></div>
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@article.user),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.user) %>
</div>
<div class="postThemeWrap">
<div class="postDetailTitle fl mt5">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;"><%= @article.title%></a>
</div>
<div class="cl"></div>
<div class="break_word" style="padding: 5px 5px 0 0">
<div class="postDetailDate"><%= format_time( @article.created_at)%></div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<div class="break_word mt10" style="padding: 5px 5px 0 0" id="intro_content">
<%=@article.content.html_safe %>
</div>
<% end %>
</div>
</div>
</div>
<script>
$(function(){
autoUrl('intro_content');
});
</script>

View File

@ -1,6 +1,6 @@
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="postContainer mb10">
<div class="homepageMainContent">
<div class="homepagePostContainer mb10">
<%= labelled_form_for @article, :url =>{:controller=>'article_homepages',:action => 'update'},
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'article_form', :locals => {:is_edit => true, :f => f} %>

View File

@ -1,6 +1,6 @@
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="postContainer mb10">
<div class="homepageMainContent">
<div class="homepagePostContainer mb10">
<%= labelled_form_for @article, :url =>{:controller=>'article_homepages',:action => 'create'},
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'article_form', :locals => {:is_edit => false, :f => f} %>

View File

@ -35,9 +35,17 @@
<% end%>
<span title="<%= attachment.filename %>" id = "attachment_">
<% if options[:length] %>
<% if User.current.logged? %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
<% else %>
<%= link_to(attachment.filename, signin_url_without_domain, :class => "link_file_board", :length => options[:length]) %>
<% end %>
<% else %>
<% if User.current.logged? %>
<%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
<% else %>
<%= link_to(attachment.filename, signin_url_without_domain,:length=> 58, :class => "hidden link_file_a fl newsBlue mw400") %>
<% end %>
<% end %>
</span>
<%if is_float%>
@ -92,7 +100,7 @@
<% end %>
<% if options[:author] %>
<span class="author" title="<%= attachment.author.show_name%>">
<%= link_to h(truncate(attachment.author.show_name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>,
<%= link_to h(truncate(attachment.author.show_name, length: 10, omission: '...')), User.current.logged? ? user_path(attachment.author) : signin_url_without_domain, :class => "link-blue" %>,
<%= format_time(attachment.created_on) %>
</span>
<% end %>

View File

@ -1,66 +1,11 @@
<!--<div class="resourceUploadPopup">-->
<span class="uploadDialogText">更新资源版本</span>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
<div>
<div>
<div>当前版本
<span class="attachment" >
<input readonly="readonly" name="attachments[1][filename]" value="<%=@attachment.filename%>" class="upload_filename readonly" type="text">
</span>
<div class="muban_popup_top">
<h3 class="fl">更新资源版本</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="hideModal();"></a>
<div class="cl"></div>
</div>
<% unless @attachment_histories.empty? %>
<div class="muban_popup_con" >
<div >历史版本</div>
<div style="max-height: 95px;overflow-y:auto; background-color: #e3e3e3;" class="mb10 p10">
<% @attachment_histories.each do |history| %>
<span class="attachment">
<%= link_to truncate(history.filename,length: 35, omission: '...'),
download_history_attachment_path(history.id, history.filename),
:title => history.filename+"\n"+history.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f_14 f_b upload_filename fl" %>
<span class="fr">版本号:<%= history.version %></span>
<div class="cl"></div>
</span>
<% end %>
<div class=" clear ml15 mr15 mt15" id="attachment_history_popub">
<%= render :partial => "files/attachment_history_popub" %>
</div>
<% end %>
</div>
<%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
<%= hidden_field_tag :old_attachment_id,@attachment.id %>
<div>
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
</span>
</div>
<div class="uploadBox">
<input type="hidden" name="attachment_type" value="1">
<%= render :partial => 'attachments/upload_attachment_new_version' %>
<div class="cl"></div>
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
</div>
<div class="W300 uploadResourceIntr fontGrey2">
<span id="upload_file_count" class="mr15">(未选择文件)</span>
<span>您可以上传小于<span class="c_red">50MB</span>的文件</span>
</div>
<div class="cl"></div>
<div class="mb5 mt5">
<p class="c_dark f14" style="line-height:30px;">描述:</p>
<div class="fl">
<textarea style="resize:none" type="text" placeholder="请编辑资源描述" name="description" class="InputBox fl H60 W420" ><%= @attachment.description %></textarea>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div style="margin-top: 10px" >
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText" onclick="">确定</a>-->
<%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<% end %>
<div class="cl"></div>
<!--</div>-->

View File

@ -0,0 +1,18 @@
<div class="muban_popup_top">
<h3 class="fl">删除资源</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="attachment_fresh_for_destroy();"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con" >
<div class=" clear ml15 mr15 mt15" id="attachment_history_popub">
<%= render :partial => "files/attachment_history_popub_delete" %>
</div>
</div>
<script>
function attachment_fresh_for_destroy(){
hideModal();
$(".re_search").submit();
}
</script>

View File

@ -1,8 +1,9 @@
<div class="clear mb10">
<a class="sub_btn fl" name="button" onclick="_file.click()" onmouseover="" style="<%= ie8? ? 'display:none' : ''%>">文件浏览</a>
<p class="fl ml5 mt3 sy_cgrey" ><span id="upload_file_count" class="c_red">(未选择文件)</span> 您可以上传小于<span class="c_red">50MB</span>的文件</p>
</div>
<!--<button name="button" class="sub_btn" onclick="_file.click()" onmouseover="this.focus()" style="<%#= ie8? ? 'display:none' : ''%>" type="button" ><%#= l(:label_browse) %></button>-->
<a href="javascript:void(0);" class="uploadIcon f14" name="button" onclick="_file.click()" onmouseover="" style="<%= ie8? ? 'display:none' : ''%>">
<span class="chooseFile">选择文件</span></a>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => ie8? ? '':'file_selector',

View File

@ -5,3 +5,6 @@ $('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' sty
$('#ajax-modal').parent().css("top","40%").css("left","50%");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
//与更新版本弹窗js冲突新增样式代码
$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"});
$('#ajax-modal').css("padding","6.6px 13.2px 16px 16px");

View File

@ -1,7 +1,2 @@
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/show_attachment_history' )%>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","40%").css("left","50%").css("position","fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
var htmlvalue = "<%= escape_javascript(render :partial => 'attachments/show_attachment_history') %>";
pop_box_new(htmlvalue,820,360);

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'attachments/show_attachment_history_delete') %>";
pop_box_new(htmlvalue,820,360);

View File

@ -1,3 +1,17 @@
//历史版本删除局部刷新
<% if @is_history %>
$("#attachment_history_popub").html('<%= escape_javascript( render :partial => 'files/attachment_history_popub') %>');
<% end %>
<% if @is_history_delete %>
$("#attachment_history_popub").html('<%= escape_javascript( render :partial => 'files/attachment_history_popub_delete') %>');
<% end %>
//历史版本删除局部刷新
<% if @is_history_destroy %>
$("#attachment_history_popub").html('<%= escape_javascript( render :partial => 'files/attachment_history_popub') %>');
<% end %>
<% if @is_destroy%>
$("#attachment_<%= @attachment.id%>").remove();
if(document.getElementById("revise_attachment_div_<%= @attachment.id%>")) {

View File

@ -1,7 +1,7 @@
<% if @flag %>
hideModal();
alert('更新成功')
$(".re_search").submit();
$(".re_search").submit(); // 为了刷新
<%else%>
$("#upload_file_count").html('(更新失败)')
<%end %>

View File

@ -92,7 +92,11 @@
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>@article.id, :content=>@article.content} %>
<div class="homepagePostIntro break_word upload_img table_maxWidth " id="activity_description_<%= @article.id%>">
<div id="intro_content_<%= @article.id%>">
<%= @article.content.to_s.html_safe %>
</div>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%#= link_to_attachments_course @topic, :author => false %>
@ -105,9 +109,9 @@
<div class="cl"></div>
</div>
<div class="cl"></div>
<%# all_comments = []%>
<%# all_replies = get_all_children(all_comments, @article) %>
<%# count= all_replies.count %>
<% all_comments = []%>
<% all_replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc") %>
<% count= all_replies.count %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复

View File

@ -36,14 +36,7 @@
<% end %>
<div class="cl"></div>
</li>
<% all_comments = [] %>
<% count = (get_all_children all_comments, activity).count %>
<%# if activity.parent %>
<%# count=activity.parent.children.count%>
<%# else %>
<%# count=activity.children.count%>
<%# end %>
<li class="ml15">
<% count=BlogComment.where("root_id = #{activity.id}").count%> <li class="ml15">
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>
<p class="list-info fr grayTxt">

View File

@ -46,7 +46,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_repies = get_all_children(all_comments, activity) %>
<% all_repies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_repies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>

View File

@ -36,5 +36,5 @@
<% html_title(l(:label_calendar)) -%>
<script>
$("#RSide").css("width","730px");
$(".project_r_h").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
</script>

View File

@ -41,7 +41,9 @@
<% if show_nav?(course_feedback_count) %>
<li>
<a href="<%=course_feedback_path(@course) %>">留言</a>
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
<% end %>
</li>
<% end %>
<% if show_nav?(course_poll_count) %>

View File

@ -45,7 +45,7 @@
<%= form_tag url_for(:controller => 'boards', :action => 'create', :course_id => @course.id, :board_id => board.id), :id=> 'add_board_form_subboard',:remote => true do %>
<div class="ml15 mt10">
<span class="fontGrey3 mb5 mr10">新增子栏目名称 :</span>
<input id="subfield_name" name="name" placeholder="请输入子栏目名称" class="orgAddSearch mb10" type="text">
<input id="subfield_name" name="name" placeholder="请输入子栏目名称" maxlength="30" class="orgAddSearch mb10" type="text">
<span id="new_notice" class="undis ml10">名称不能为空</span>
</div>
<div class="mb10">

View File

@ -0,0 +1,66 @@
<table class="muban_table mb15" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>资源名称</th>
<th >下载数</th>
<th>引用数</th>
<th>版本号</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th ><p class="popup_ziyuan_title fl"><%= @attachment.filename %></p><span class="muban_icons_blue ml5 fl mt12">当前版本</span></th>
<th><%= @attachment.downloads %></th>
<th><%= @attachment.try(:quotes).to_i %></th>
<th><%= format_time(@attachment.created_on) %></th>
<!--<th></th>-->
</tr>
<% @attachment_histories.each do |history| %>
<tr>
<th ><p class="popup_ziyuan_title">
<%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p>
</th>
<th><%= history.downloads %></th>
<th><%= history.try(:quotes).to_i %></th>
<th><%= format_time(history.created_on) %></th>
<!--<th>-->
<%#= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"),
# :remote => true,
# :data => {:confirm => l(:text_are_you_sure)},
# :method => :delete,
# :class => "postOptionLink",
:class => "btn") if allow_to_delete_attachment(history) %>
<!--</th>-->
</tr>
<% end %>
</tbody>
</table>
<%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
<%= hidden_field_tag :old_attachment_id,@attachment.id %>
<div>
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
</span>
</div>
<div class="clear mb10">
<input type="hidden" name="attachment_type" value="1">
<%= render :partial => 'attachments/upload_attachment_new_version' %>
<div class="cl"></div>
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
</div>
<div class="cl"></div>
<textarea style="resize:none" type="text" placeholder="请在此编辑资源描述" name="description" class="mr15 mb10 muban_textarea" ><%= @attachment.description %></textarea>
<div class="clear mb15">
<a href="javascript:void(0);" id="upload_files_cancle_btn" class="btn fr" onclick="attachment_fresh_for_destroy()">取消</a>
<%#= submit_tag '确定', :onclick => 'upload_attachment_version(event);', :onfocus => 'this.blur()', :id => 'upload_files_submit_btn', :class => 'btn btn-blue fr mr5' %>
<a href="javascript:void(0);" onclick = "upload_attachment_version(event);" onfocus = 'this.blur()' id = 'upload_files_submit_btn' class = 'btn btn-blue fr mr5' >确定</a>
</div>
<% end %>
<script>
function attachment_fresh_for_destroy(){
hideModal();
$(".re_search").submit();
}
</script>

View File

@ -0,0 +1,54 @@
<table class="muban_table mb10" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>资源名称</th>
<th >下载数</th>
<th>引用数</th>
<th>版本号</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th ><p class="popup_ziyuan_title"><%= @attachment.filename %><span class="muban_icons_blue ml5">当前版本</span></p></th>
<th><%= @attachment.downloads %></th>
<th><%= @attachment.try(:quotes).to_i %></th>
<th><%= format_time(@attachment.created_on) %></th>
<th></th>
</tr>
<% @attachment_histories.each do |history| %>
<tr>
<th ><p class="popup_ziyuan_title">
<%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p>
</th>
<th><%= history.downloads %></th>
<th><%= history.try(:quotes).to_i %></th>
<th><%= format_time(history.created_on) %></th>
<th>
<%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history_delete"),
:remote => true,
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => "postOptionLink",
:class => "btn") if allow_to_delete_attachment(history) %>
</th>
</tr>
<% end %>
</tbody>
</table>
<div>
<% if @attachment.container_type == "Project" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
<% elsif @attachment.container_type == "Course" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
<% elsif @attachment.container_type == "OrgSubfield" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
<% end %>
</div>

View File

@ -43,8 +43,10 @@
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_org_subfield_file_path(file.container,file)%>','<%= file.id %>');"><%= file.description %></textarea>
<%= form_tag(edit_file_description_org_subfield_file_path(file, :org_subfield_id => org_subfield.id ),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
<div class="fontGrey2 mb4">
@ -77,8 +79,14 @@
</li>
<% end %>
<li>
<% if file.destroyable %>
<%= link_to( '删除资源', attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
:data => {:confirm => file.destroyable ? l(:text_are_you_sure) : l(:text_history_are_you_sure)},
:method => :delete,
:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
<% else %>
<%= link_to '删除资源', attachment_versions_delete_path(file), :class => "postOptionLink", :remote => true %>
<% end %>
</li>
</ul>
<%else%>
@ -108,3 +116,8 @@
<%end%>
<% end%>
<script>
function commit_files_description(id) {
$(id).submit();
}
</script>

View File

@ -11,10 +11,10 @@
<%# 如果有历史版本则提供历史版本下载 %>
<% if file.attachment_histories.count == 0 %>
<%= link_to truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
User.current.logged? ? download_named_attachment_path(file.id, file.filename) : signin_url_without_domain,
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
<% else %>
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
<%= link_to truncate(file.filename,length: 35, omission: '...'), User.current.logged? ? attachment_history_download_path(file.id) : signin_url_without_domain,
:title => file.filename+"\n"+file.description.to_s,
:class => "linkGrey3 f_14",
:style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
@ -40,8 +40,10 @@
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_project_file_path(project,file)%>','<%= file.id %>');"><%= file.description %></textarea>
<%= form_tag(edit_file_description_project_file_path(file, :project_id => project.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
<div class="fontGrey2 mb4">
@ -70,6 +72,11 @@
<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%>
</ul>
<script>
function commit_files_description(id) {
$(id).submit();
}
</script>

View File

@ -39,11 +39,13 @@
<div class="cl"></div>
<% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course")) %>
<div>
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4 break_word">
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
</div>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
onblur="edit_file_description('<%= update_file_description_course_file_path(@course,file)%>','<%= file.id %>');"><%= file.description %></textarea>
<%= form_tag(edit_file_description_course_file_path(file, :course_id => @course.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
<div class="fontGrey2 mb4">
@ -79,9 +81,11 @@
</li>
<%end%>
<li>
<%= link_to( '删除资源', attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
<% if file.destroyable %>
<%= link_to( '删除资源', attachment_path(file),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
<% else %>
<%= link_to '删除资源',attachment_versions_delete_path(file), :class => "postOptionLink", :remote => true %>
<% end %>
</li>
</ul>
<% end %>
@ -100,3 +104,8 @@
</div>
</div>
<div class="cl"></div>
<script>
function commit_files_description(id) {
$(id).submit();
}
</script>

View File

@ -27,7 +27,11 @@
</li>
<% end %>
<li>
<%= link_to( '删除资源', attachment_path(file),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" && file.destroyable %>
<% if file.destroyable %>
<%= link_to( '删除资源', attachment_path(file),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %>
<% else %>
<%= link_to '删除资源',attachment_versions_delete_path(file), :class => "postOptionLink", :remote => true %>
<% end %>
</li>
</ul>
<% end %>

View File

@ -0,0 +1,3 @@
$("#file_description_show_<%= @attachment.id %>").html("<%= escape_javascript render(:partial => "files/file_description", :locals => {:file => @attachment}) %>");
$("#file_description_show_<%= @attachment.id %>").show();
$("#file_description_edit_<%= @attachment.id %>").hide();

View File

@ -1,6 +1,9 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>');
showModal('ajax-modal', '311px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 280px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 290px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
$('#ajax-modal').parent().addClass("popbox_polls").removeClass("resourceUploadPopup popbox");
//与更新版本弹窗js冲突新增样式代码
$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"});
$('#ajax-modal').css({"padding":"","min-height":""});

View File

@ -1,4 +1,3 @@
<% if @container_type == 0 %>
<div id="resource_list">
<%= render :partial => 'project_file', locals: {project: @project} %>
@ -442,12 +441,10 @@
if($("#upload_form").find('.upload_filename').length > 1){
$("#upload_file_count").html('(只能上传一个更新文件)')
event.preventDefault();
return false;
}else if($("#upload_form").find('.upload_filename').length == 0){
$("#upload_file_count").html('(请上传一个更新文件)')
event.preventDefault();
return false;
}else{
$("#upload_form").submit();

View File

@ -35,5 +35,5 @@
<% end %>
<% else %>
<%= render :partial => "layouts/no_content" %>
<%#= render :partial => "layouts/no_content" %>
<% end %>

View File

@ -74,6 +74,7 @@
});
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;

View File

@ -319,5 +319,5 @@
<% end %>
<script>
$("#RSide").css("width","730px");
$(".project_r_h").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
</script>

View File

@ -1,15 +1,13 @@
<div class="cl"> </div>
<div id="blog-list">
<div class="listbox mt10">
<h2 class="list-h2 fl">个人主页列表</h2>
<div class="fr">
<%=link_to '新 建', new_article_homepage_path(), :target => "_blank", :class => 'BlueCirBtn' %>
</div>
<div class="cl"></div>
<div class="category">
<div class="category" style="padding: 5px 0;">
<span class="grayTxt">排序:</span>
<%= link_to "时间", {:controller => 'homepages', :action => 'index', :id =>@user, :sort => @b_sort}, :class => "sortTxt", :remote => true %>
<%= link_to "", {:controller => 'homepages', :action => 'index', :id =>@user, :sort => @b_sort}, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<%= link_to "时间", {:controller => 'homepages', :action => 'index', :user_id =>@user.id, :sort => @b_sort}, :class => "sortTxt", :remote => true %>
<%= link_to "", {:controller => 'homepages', :action => 'index', :user_id =>@user.id, :sort => @b_sort}, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<div class="fr">
<%=link_to '新 建', new_article_homepage_path(), :target => "_blank", :class => 'BlueCirBtnMiddle', :style => 'margin-right: 0;' %>
</div>
<div class="cl"></div>
</div>
<div class="bloglistbox">
@ -17,59 +15,33 @@
<% @articles.each do |activity| %>
<ul class="list-file pr" onmouseover='$("#message_setting_<%= activity.id%>").show();' onmouseout='$("#message_setting_<%= activity.id%>").hide();'>
<li><span class="item_list fl"></span>
<%= link_to activity.title.to_s.html_safe, user_homepage_article_homepage_path(:user_id=>activity.user_id, :homepage_id=>activity.homepage_id,:id=>activity), :class=> "list-title fl", :target => '_blank' %>
<% if activity.homepage.article_id and activity.id == activity.homepage.article_id %>
<%= link_to activity.title.to_s.html_safe, homepage_user_path(activity.user.login), :class=> "list-title fl", :target => '_blank' %>
<span class="red_homework_btn_cir ml5">主页</span>
<% else %>
<%= link_to activity.title.to_s.html_safe, user_homepage_show_path(:user_id=>activity.user_id,:id=>activity), :class=> "list-title fl", :target => '_blank' %>
<% end %>
<div class="cl"></div>
</li>
<li class="ml15">
<span class="grayTxt">更新:<%= format_time(activity.updated_at) %></span>
</li>
<div class="cl"></div>
<div class="homepagePostSetting" id="message_setting_<%= activity.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<% if activity.id == activity.homepage.article_id %>
<%= link_to(
l(:button_cancel_base_homepage),
{:controller => 'homepages',:action => 'cancel_homepage',:user_id=>activity.user_id,:id=>activity.homepage_id, :article_id => activity.id},
:method => :post,
:remote => true,
:class => 'postOptionLink'
) if User.current && User.current.id == activity.homepage.user_id %>
<% else %>
<%= link_to(
l(:button_set_base_homepage),
{:controller => 'homepages',:action => 'set_homepage',:user_id=>activity.user_id,:id=>activity.homepage_id, :article_id => activity.id},
:method => :post,
:remote => true,
:class => 'postOptionLink'
) if User.current && User.current.id == activity.homepage.user_id %>
<% end %>
</li>
<li>
<%= link_to(
l(:button_edit),
{:controller => 'article_homepages',:action => 'edit', :id => activity.id},
:class => 'postOptionLink'
) if User.current.admin? || User.current.id == activity.user_id %>
</li>
<li>
<span class="grayTxt fl">更新:<%= format_time(activity.updated_at) %></span>
<div>
<%= link_to(
l(:button_delete),
{:controller => 'article_homepages',:action => 'destroy', :id => activity.id},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
:class => 'fr'
) if User.current.admin? || User.current.id == activity.user_id %>
</li>
</ul>
</li>
</ul>
<%= link_to(
l(:button_edit),
{:controller => 'article_homepages',:action => 'edit', :id => activity.id},
:class => 'fr mr10'
) if User.current.admin? || User.current.id == activity.user_id %>
<div class="cl"></div>
</div>
</li>
<div class="cl"></div>
</ul>
<% end %>
<div>

View File

@ -1 +0,0 @@
$("#user_homepages").html('<%= escape_javascript(render :partial => 'articles') %>');

View File

@ -1,7 +1,7 @@
<div class="homepageRight mt0">
<div class="homepageRightBanner">
<div class="f16 fl fontGrey3">
个人主页
设置个人主页
</div>
</div>
<div class="cl"></div>

View File

@ -1 +1 @@
$("#blog-list").replaceWith('<%= escape_javascript( render :partial => 'articles') %>');
$("#blog-list").replaceWith('<%= escape_javascript( render :partial => 'article_list') %>');

View File

@ -1 +0,0 @@
$("#user_homepages").html('<%= escape_javascript(render :partial => 'articles') %>');

View File

@ -24,15 +24,15 @@
<% end %>
</li>
<div class="cl"></div>
<li>
<label class="label">来源:</label>
<select class="w150">
<option>客户</option>
<option>用户</option>
<option>其他</option>
</select>
</li>
<div class="cl"></div>
<!--<li>-->
<!--<label class="label">来源:</label>-->
<!--<select class="w150">-->
<!--<option>客户</option>-->
<!--<option>用户</option>-->
<!--<option>其他</option>-->
<!--</select>-->
<!--</li>-->
<!--<div class="cl"></div>-->
<li>
<label class="label"><%= l(:field_assigned_to) %></label>
<% if @issue.safe_attribute? 'assigned_to_id' %>
@ -85,13 +85,6 @@
<% end %>
</li>
<div class="cl"></div>
<li>
<label class="label02">实际工时 (H)</label>
<% if @issue.safe_attribute? 'estimated_hours' %>
<%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true %>
<% end %>
</li>
<div class="cl"></div>
<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] }),

View File

@ -158,6 +158,8 @@ function cookieget(n)
})
</script>
<% forum = Forum.where(:id => 1).first %>
<% unless forum.nil? %>
<div class="scrollsidebar" id="scrollsidebar" style="float: right">
<div class="side_content">
<div class="side_list">
@ -189,4 +191,5 @@ function cookieget(n)
<a href="#" class="closeSidebar"></a>
</div>
</div>
<% end %>
</body>

View File

@ -4,7 +4,10 @@
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="https://forge.trustie.net/projects/2/feedback" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_recruitment_information)%></a>|</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
<select class="languageBox">

View File

@ -3,7 +3,7 @@
<% course_board.children.reorder("position asc").each do |board| %>
<li>
<% count = board ? (board.topics.count + Message.where("board_id =? and parent_id is not ?", board.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course, :board_id =>board.id) %>"><%=board.name %><span><%=count %></span></a>
<a href="<%=course_boards_path(@course, :board_id =>board.id) %>"><font class="hidden dis" style="max-width: 120px;"><%=board.name %></font><span style="vertical-align: top;"><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :board_id =>board.id, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li>
<% end %>

View File

@ -4,7 +4,8 @@
<li class="fl"><a href="<%= about_us_path %>" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<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>
<% if hidden_unproject_infos %>
<% memo = Memo.where(:id => 1168).first %>
<% if hidden_unproject_infos && !memo.nil? %>
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>

View File

@ -1,5 +1,7 @@
<%= javascript_include_tag "feedback" %>
<% forum = Forum.where(:id => 1).first %>
<% unless forum.nil? %>
<div class="scrollsidebar" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
@ -49,3 +51,4 @@
</div>
</div>
</div>
<% end %>

View File

@ -8,17 +8,21 @@
<%= link_to "首页",user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页"%>
</li>
<li class="navHomepageMenu fl">
<%= link_to "资源库", user_resource_user_path(User.current, :type => 6), :class => "c_white f16 db p10" %>
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
</li>
<% if hidden_unproject_infos %>
<li class="navHomepageMenu fl">
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li>
<!--<li class="navHomepageMenu fl mr30">-->
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
<!--</li>-->
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr30">
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
</li>
<% end %>
<% else %>
<li class="navHomepageMenu fl mr40">
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" >公共贴吧</a>
</li>
<% end %>
</ul>
@ -47,7 +51,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子"/>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>

View File

@ -14,10 +14,13 @@
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr30">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="fl" id="navHomepageSearch">

View File

@ -1,5 +1,6 @@
<%= javascript_include_tag "feedback" %>
<% forum = Forum.where(:id => 1).first %>
<% unless forum.nil? %>
<div class="scrollsidebar pr" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
@ -49,3 +50,4 @@
</div>
</div>
</div>
<% end %>

View File

@ -2,7 +2,10 @@
<ul>
<li ><a href="<%= about_us_path %>" target="_blank" class="" >关于我们<span>|</span></a></li>
<li ><a href="<%= agreement_path %>" target="_blank" class="" >服务协议<span>|</span></a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li ><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="" >帮助中心<span>|</span></a></li>
<% end %>
<li ><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="" > 贴吧交流</a></li>
<div class="cl"></div>
</ul>

View File

@ -3,7 +3,10 @@
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<% end %>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="sn-link-white sn-f18">在线报名</a></li>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>

View File

@ -7,9 +7,12 @@
<!--<li class="navHomepageMenu fl mr40">-->
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
<!--</li>-->
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr40">
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
</li>
<% end %>
</ul>
</div>
<script>

View File

@ -2,14 +2,14 @@
<% if User.current.logged?%>
<% if User.current == target%>
<li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%= link_to("编辑基本资料", my_account_path, :class => "user_editinfo") %></li>
<li style="width: 118px; float: left;"><%= link_to '个人主页', user_homepages_path(:user_id => @user.id) , :class => "user_editinfo" %></li>
<li style="width: 118px; float: left;"><%= link_to '个人主页', homepage_user_path(@user.login), :class => "user_editinfo", :target => '_blank' %></li>
<li class="cl"></li>
<% else%>
<li style="width: 119px; float: left; border-right: 1px solid #ddd;">
<% if @user.base_homepage.nil? %>
<% if target.base_homepage.nil? %>
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">主页</a>
<% else %>
<%=link_to "主页", homepage_user_path(@user), :class => 'user_editinfo', :target => '_blank' %>
<%=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
<% end %>
</li>
<li style="width: 118px; float: left;">

View File

@ -19,7 +19,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus'%>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel'%>
<%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
@ -69,7 +69,7 @@
<li id="sy_02" class="sy_icons_boards">
<% count = course_board ? (course_board.topics.count + Message.where("board_id =? and parent_id is not ?", course_board.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course) %>">讨论区<span><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") if is_teacher %>
</li>
<div id="board_children_list">
<%= render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board} %>
@ -98,7 +98,7 @@
<% unless show_nav?(course_feedback_count) %>
<li id="sy_06" class="sy_icons_feedback">
<a href="<%=course_feedback_path(@course) %>">留言<span id="course_jour_count"><%=course_feedback_count %></span></a>
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
<%= link_to( "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}") if is_teacher %>
</li>
<% end %>
<% unless show_nav?(course_poll_count) %>
@ -110,7 +110,7 @@
<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %>
<% unless show_nav?(count) %>
<li id="sy_08" class="sy_icons_exercise">
<a href="<%=exercise_index_path(:course_id => @course.id) %>">在线测验<span><%=count %></span></a>
<a href="<%= User.current.logged? ? exercise_index_path(:course_id => @course.id) : signin_url_without_domain %>">在线测验<span><%=count %></span></a>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
</li>
<% end %>
@ -230,6 +230,9 @@
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
//与更新版本弹窗js冲突新增样式代码
$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"});
$('#ajax-modal').css("padding","");
}
// 鼠标经过的时候显示内容
function message_titile_show(obj,e)

View File

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup' %>
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup', 'css/moduel' %>
<%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %>
<%= call_hook :view_layouts_base_html_head %>
@ -152,7 +152,10 @@
<ul class="footerAbout">
<li class="fl"><a href="<%= about_us_path %>" class=" f_grey mw20" target="_blank">关于我们</a>|</li>
<li class="fl"><a href="<%= agreement_path %>" class=" f_grey mw20" target="_blank">服务协议</a>|</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
<% end %>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank">贴吧交流</a></li>
</ul>
</div>

View File

@ -172,8 +172,10 @@
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<% end %>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>
<div class="sn-address">地 址湖南省长沙市开福区东风路89号观园大厦23层<br />

View File

@ -406,7 +406,10 @@
<ul>
<li><a href="<%= about_us_path %>" target="_blank" class="fl">关于我们</a></li>
<li><a href="<%= agreement_path %>" target="_blank" class="fl"> 服务协议 </a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="fl">帮助中心</a></li>
<% end %>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="fl"> 贴吧交流</a></li>
</ul>
<div class="cl"></div>

View File

@ -106,7 +106,10 @@
<ul class="footerAbout">
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">关于我们</a>|</li>
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">服务协议</a>|</li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="fl"><a href="javascript:void(0);" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
<% end %>
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">贴吧交流</a></li>
</ul>
</div>

View File

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository','css/gantt', 'css/calendar' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository','css/gantt', 'css/calendar', "css/moduel" %>
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
<%= call_hook :view_layouts_base_html_head %>
@ -89,7 +89,7 @@
</div>
<div id="RSide" class="fl">
<div class="fl">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
@ -172,6 +172,9 @@
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
//与更新版本弹窗js冲突新增样式代码
$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"});
$('#ajax-modal').css("padding","");
}
$("#expand_tools_expand").click(function(){

View File

@ -146,13 +146,13 @@
</div>
<% if @center_flag %>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_courses',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_courselist',:id=>@user.id)%>" class=" f14 c_blue02">
我的课程
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.count%>)</span>
</a>
</div>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_projects',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_projectlist',:id=>@user.id)%>" class=" f14 c_blue02">
我的项目
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.count%>)</span>
</a>
@ -166,13 +166,13 @@
<% else%>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_courses',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_courselist',:id=>@user.id)%>" class=" f14 c_blue02">
TA的课程
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.visible.count%>)</span>
</a>
</div>
<div class="subNav">
<a href="<%=url_for(:controller => 'users', :action => 'user_projects',:id=>@user.id)%>" class=" f14 c_blue02">
<a href="<%=url_for(:controller => 'users', :action => 'user_projectlist',:id=>@user.id)%>" class=" f14 c_blue02">
TA的项目
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.visible.count%>)</span>
</a>

View File

@ -125,7 +125,7 @@
<% end%>
</div>
<div>
<div class="user_info_intro">
<div class="user_info_intro" style="word-wrap:break-word; text-align:justify;">
<div id="user_brief_introduction_show">
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</div>

View File

@ -36,7 +36,7 @@
<li>地区&nbsp;:&nbsp;</li>
<li>邮件通知&nbsp;:&nbsp;</li>
<!--<li>个人签名&nbsp;:&nbsp;</li>-->
<li>个人简介&nbsp;:&nbsp;</li>
<li>个人主页&nbsp;:&nbsp;</li>
<li>&nbsp;&nbsp;</li>
</ul>
<ul class="setting_right ">
@ -182,7 +182,7 @@
<li style="height:auto;">
<% if @user.homepage && !@user.homepage.article_homepages.empty? %>
<% if @user.base_homepage %>
<%=link_to '查看', homepage_user_path(@user), :class => 'linkBlue',:target => '_blank' %>
<%=link_to '查看', homepage_user_path(@user.login), :class => 'linkBlue',:target => '_blank' %>
<% else %>
<%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %>
<% end %>

View File

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

View File

@ -3,7 +3,10 @@
<ul class="sn-footer-link">
<li class="sn-mr50"><a href="<%= about_us_path %>" class="sn-link-white sn-f18">关于我们</a></li>
<li class="sn-mr50"><a href="<%= agreement_path %>" class="sn-link-white sn-f18">服务协议</a></li>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="sn-mr50"><a href="http://forge.trustie.net/forums/1/memos/1168" class="sn-link-white sn-f18">帮助中心</a></li>
<% end %>
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="sn-link-white sn-f18">在线报名</a></li>
</ul>
<div class="sn-contact">联系人:魏小姐 | 电 话0731-84761282 | 传 真0731-84761268 | 邮 箱office@gnssopenlab.org</div>

View File

@ -9,3 +9,4 @@
<!--<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_org_project('<%#= more_org_projects_organization_path(org_id) %>');"></a>-->
<!--</li>-->
<%# end%>

View File

@ -70,7 +70,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = OrgDocumentComment.where("root_id = #{activity.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>

View File

@ -68,7 +68,7 @@
</div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, document) %>
<% all_replies = OrgDocumentComment.where("root_id = #{document.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">

View File

@ -0,0 +1 @@
$("#show_more_org_submains").replaceWith("<%= escape_javascript( render :partial => 'organizations/org_subdomain',:locals => {:subdomains => @submains, :org_subfield_id => @org_subfield.id, :page=> @page, :org_id => @organization } )%>");

View File

@ -497,7 +497,15 @@ function insert_MCQ(quest_type,quest_num,quest_id){
}else if(forms.length > 0){
alert("请先保存正在编辑的题目。");
} else {
window.location.href = "<%=edit_poll_path(@poll) %>";
if($("#show_result").is(":checked")) {
$.get(
'<%= save_poll_poll_path(@poll.id) %>'+'?show_result=1'
)
} else{
$.get(
'<%= save_poll_poll_path(@poll.id) %>'+'?show_result=0'
)
}
}
}
function poll_submit()

View File

@ -0,0 +1,21 @@
<div class="sy_popup_top">
<h3 class="fl">提示</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div>
<ul class="sy_popup_add mt10 mb10">
<li>
<p style="text-align: center">
问卷保存成功
</p>
</li>
<li>
<label style="margin-right: 117px;">&nbsp;</label>
<%= link_to('确 定', edit_poll_path(@poll), :class => "sy_btn_blue fl") %>
<div class="cl"></div>
</li>
</ul>
</div>

View File

@ -1,7 +1,7 @@
<div class="testStatus" onmouseover="$('#poll_head_edit_pen').show();" onmouseout="$('#poll_head_edit_pen').hide();"><!--头部显示 start-->
<a href="javascript:" class="testEdit undis" id="poll_head_edit_pen" title="编辑" onclick="pollsEdit();" style="top:0;"></a>
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
<h1 class="ur_page_title" id="polls_name_h"><%= poll.polls_name%></h1>
<h1 class="ur_page_title" id="polls_name_h" style="width:668px; margin:0 auto;"><%= poll.polls_name%></h1>
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>
<div class="cl"></div>
</div><!--头部显示 end-->

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