Merge branch 'hjq_new_course' of http://repository.trustie.net/xianbo/trustie2 into hjq_new_course

This commit is contained in:
huang 2015-12-04 00:16:21 +08:00
commit 5d18b14e73
41 changed files with 557 additions and 146 deletions

View File

@ -374,6 +374,9 @@ class FilesController < ApplicationController
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.run.attachments_added(attachments[:files]) Mailer.run.attachments_added(attachments[:files])
end end
# 更新课程英雄榜得分
update_contributor_score(@course, attachments[:files].first)
# end
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
params[:course_attachment_type].each do |type| params[:course_attachment_type].each do |type|
tag_name = get_tag_name_by_type_number type tag_name = get_tag_name_by_type_number type
@ -423,6 +426,20 @@ class FilesController < ApplicationController
end end
end end
def update_contributor_score(course, file )
unless file.author.allowed_to?(:as_teacher, course)
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5)
else
score = course_contributor_score.resource_num + 5
total_score = course_contributor_score.total_score + 5
course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score)
end
end
end
def get_tag_name_by_type_number type def get_tag_name_by_type_number type
case type case type
when "1" when "1"

View File

@ -3,7 +3,9 @@ class OrgCoursesController < ApplicationController
org_ids = params[:orgNames] org_ids = params[:orgNames]
@course = Course.find(params[:course_id]) @course = Course.find(params[:course_id])
org_ids.each do |org_id| org_ids.each do |org_id|
OrgCourse.create(:organization_id => org_id.to_i, :course_id => params[:course_id].to_i, :created_at => Time.now) if OrgCourse.where("organization_id =? and course_id =?", org_id.to_i, params[:course_id].to_i).count == 0
OrgCourse.create(:organization_id => org_id.to_i, :course_id => params[:course_id].to_i, :created_at => Time.now)
end
end end
respond_to do |format| respond_to do |format|
format.js format.js

View File

@ -38,12 +38,19 @@ class OrgDocumentCommentsController < ApplicationController
act.update_attributes(:updated_at => @org_document.updated_at) act.update_attributes(:updated_at => @org_document.updated_at)
end end
respond_to do |format| respond_to do |format|
format.html {redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)} format.html {
if params[:flag] == 0
redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)
else
redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
end
}
end end
end end
def edit def edit
@org_document = OrgDocumentComment.find(params[:id]) @org_document = OrgDocumentComment.find(params[:id])
@flag = params[:flag]
@organization = Organization.find(params[:organization_id]) @organization = Organization.find(params[:organization_id])
end end

View File

@ -3,7 +3,9 @@ class OrgProjectsController < ApplicationController
org_ids = params[:orgNames] org_ids = params[:orgNames]
@project = Project.find(params[:project_id]) @project = Project.find(params[:project_id])
org_ids.each do |org_id| org_ids.each do |org_id|
OrgProject.create(:organization_id => org_id.to_i, :project_id => params[:project_id].to_i, :created_at => Time.now) if OrgProject.where("organization_id =? and project_id =?", org_id.to_i, @project.id).count == 0
OrgProject.create(:organization_id => org_id.to_i, :project_id => params[:project_id].to_i, :created_at => Time.now)
end
end end
respond_to do |format| respond_to do |format|
format.js format.js

View File

@ -175,4 +175,75 @@ class OrganizationsController < ApplicationController
format.js format.js
end end
end end
def join_course_menu
@organization = Organization.find(params[:id])
respond_to do |format|
format.js
end
end
def search_courses
@organization = Organization.find(params[:id])
condition = '%%'
if !params[:name].nil?
condition = "%#{params[:name].strip}%".gsub(" ","")
end
#sql = "select courses.* from courses inner join members on courses.id = members.course_id inner join org_courses on courses.id = org_courses.course_id where org_courses.organization_id != #{@organization.id} and members.user_id = #{User.current.id} and courses.name like '#{condition}'"
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"
user_courses = Course.find_by_sql(sql)
@added_course_ids = @organization.courses.map(&:id)
@courses = []
user_courses.each do |course|
if !@added_course_ids.include?(course.id)
@courses << course
end
end
end
def join_courses
@organization = Organization.find(params[:id])
course_ids = params[:courseNames]
course_ids.each do |id|
OrgCourse.create(:organization_id => @organization.id, :course_id => id.to_i, :created_at => Time.now)
end
respond_to do |format|
format.js
end
end
def join_project_menu
@organization = Organization.find(params[:id])
respond_to do |format|
format.js
end
end
def search_projects
@organization = Organization.find(params[:id])
condition = '%%'
if !params[:name].nil?
condition = "%#{params[:name].strip}%".gsub(" ","")
end
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'"
user_projects = Course.find_by_sql(sql)
@added_course_ids = @organization.projects.map(&:id)
@projects = []
user_projects.each do |project|
if !@added_course_ids.include?(project.id)
@projects << project
end
end
end
def join_projects
@organization = Organization.find(params[:id])
project_ids = params[:projectNames]
project_ids.each do |id|
OrgProject.create(:organization_id => @organization.id, :project_id => id.to_i, :created_at => Time.now)
end
respond_to do |format|
format.js
end
end
end end

View File

@ -83,34 +83,38 @@ module ApplicationHelper
when "JournalForMessage" when "JournalForMessage"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0) :news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0, :total_score => 1)
else else
score = course_contributor_score.journal_num + 1 score = course_contributor_score.journal_num + 1
course_contributor_score.update_attributes(:journal_num => score) total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:journal_num => score, :total_score => total_score)
end end
when "Message" when "Message"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 2)
else else
score = course_contributor_score.message_num + 2 score = course_contributor_score.message_num + 2
course_contributor_score.update_attributes(:message_num => score) total_score = course_contributor_score.total_score + 2
course_contributor_score.update_attributes(:message_num => score, :total_score => total_score)
end end
when "MessageReply" when "MessageReply"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
else else
score = course_contributor_score.message_reply_num + 1 score = course_contributor_score.message_reply_num + 1
course_contributor_score.update_attributes(:message_reply_num => score) total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:message_reply_num => score, :total_score => total_score)
end end
when "NewReply" when "NewReply"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0) :news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
else else
score = course_contributor_score.news_reply_num + 1 score = course_contributor_score.news_reply_num + 1
course_contributor_score.update_attributes(:news_reply_num => score) total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:news_reply_num => score, :total_score => total_score)
end end
end end
end end

View File

@ -751,14 +751,11 @@ module CoursesHelper
JOIN students_for_courses JOIN students_for_courses
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 9" WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 9"
sql = ActiveRecord::Base.connection()
homework_scores = Member.find_by_sql(sql_select) homework_scores = Member.find_by_sql(sql_select)
sql.close()
homework_scores
end end
def contributor_course_scor(course_id) def contributor_course_scor(course_id)
ccs = CourseContributorScore.where("course_id =?", course_id).limit(9) ccs = CourseContributorScore.where("course_id =?", course_id).order("total_score desc") .limit(9)
end end
end end

View File

@ -73,11 +73,10 @@ class Attachment < ActiveRecord::Base
cattr_accessor :thumbnails_storage_path cattr_accessor :thumbnails_storage_path
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location,:act_as_course_activity, :act_as_student_score before_save :files_to_final_location,:act_as_course_activity
after_create :office_conver, :be_user_score,:act_as_forge_activity after_create :office_conver, :be_user_score,:act_as_forge_activity
after_update :office_conver, :be_user_score after_update :office_conver, :be_user_score
after_destroy :delete_from_disk,:down_user_score after_destroy :delete_from_disk,:down_user_score
# after_save :act_as_student_score
# add by nwb # add by nwb
# 获取所有可公开的资源文件列表 # 获取所有可公开的资源文件列表
@ -562,18 +561,4 @@ class Attachment < ActiveRecord::Base
end end
end end
# 课程成员得分(英雄榜)
def act_as_student_score
unless self.author.allowed_to?(:as_teacher, self.container)
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", self.container_id, self.author_id).first
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => self.container_id, :user_id => self.author_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0)
else
score = course_contributor_score.news_reply_num + 5
course_contributor_score.update_attributes(:resource_num => score)
end
end
end
end end

View File

@ -1,5 +1,5 @@
class CourseContributorScore < ActiveRecord::Base class CourseContributorScore < ActiveRecord::Base
attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score
belongs_to :course belongs_to :course
belongs_to :user belongs_to :user
end end

View File

@ -2,19 +2,19 @@
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if show_nav?(@course.homework_commons.count) %> <% if show_nav?(@course.homework_commons.count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%> <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02 ml10"%>
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %> <%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(@course.news.count) %> <% if show_nav?(@course.news.count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02 ml10" %>
<%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %> <%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(course_file_num) %> <% if show_nav?(course_file_num) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02 ml10" %>
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %> <% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
<!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')--> <!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')-->
<a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a> <a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
@ -23,25 +23,25 @@
<% end %> <% end %>
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> <% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02 ml10" %>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %> <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(course_feedback_count) %> <% if show_nav?(course_feedback_count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02 ml10" %>
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}", :id => "course_jour_count"%> <%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}", :id => "course_jour_count"%>
</div> </div>
<% end %> <% end %>
<% if show_nav?(course_poll_count) %> <% if show_nav?(course_poll_count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02"%> <%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02 ml10"%>
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %> <%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> <% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %>
<div class="subNav"> <div class="subNav">
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%> <%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02 ml10"%>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %> <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
</div> </div>
<% end %> <% end %>

View File

@ -68,8 +68,7 @@
}); });
}); });
function cancel_join_orgs() { function cancel_join_orgs() {
$("#search_orgs_result_list").html(""); $("#join_orgs_for_course input:checked").attr("checked", false);
$("#paginator").css("display", "none")
} }
function course_join_org(courseId) { function course_join_org(courseId) {
$.ajax({ $.ajax({

View File

@ -178,7 +178,7 @@
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange", :id => "course_jour_count"%> <%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange", :id => "course_jour_count"%>
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}", :id => "course_jour_count"%> <%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
</div> </div>
<% end %> <% end %>
<% unless show_nav?(course_poll_count) %> <% unless show_nav?(course_poll_count) %>
@ -196,48 +196,65 @@
</div> </div>
<% end %> <% end %>
<%# 工具栏展开 %> <%# 工具栏展开 %>
<div class="subNav subNav_jiantou" id="expand_tools_expand" nhtype="toggle4cookie" data-id="expand_tool_more" data-target="#navContentCourse" data-val="retract"><%= l(:label_project_more) %></div> <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 ||
<ul class="navContent" id="navContentCourse"> course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %>
<%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %> <div class="subNav subNav_jiantou" id="expand_tools_expand" nhtype="toggle4cookie" data-id="expand_tool_more" data-target="#navContentCourse" data-val="retract"><%= l(:label_project_more) %></div>
</ul> <ul class="navContent" id="navContentCourse">
<%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %>
</ul>
<% end %>
</div><!--项目侧导航 end--> </div><!--项目侧导航 end-->
<%# 课程贡献榜 %> <%# 课程贡献榜 %>
<div class="cl"></div> <div class="cl"></div>
<ul class="rankList"> <% unless contributor_course_scor(@course.id).count == 0 %>
<p class="fontGrey2 f14">课程贡献榜</p> <ul class="rankList">
<% contributor_course_scor(@course.id).each do |student_score| %> <h4>课程贡献榜</h4>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a> <% contributor_course_scor(@course.id).each do |contributor_score| %>
<p><a href="javascript:void:(0);"><%=link_to student_score.user, user_path(student_score.user) %></a></p> <% unless contributor_score.total_score ==0 %>
<p><span class="c_green" style="cursor:pointer"> <li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %></a>
<%#= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id }, <p><a href="javascript:void:(0);"><%=link_to contributor_score.user, user_path(contributor_score.user), :title => contributor_score.user %></a></p>
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", <p><span class="c_green" style="cursor:pointer">
:onmouseover =>"message_titile_show($(this),event)", <a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green"><%= contributor_score.total_score.to_i %></a></span></p>
:onmouseout => "message_titile_hide($(this))" %> <div style="display: none" class="numIntro">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))"><%= student_score.total_score.to_i %></a></span></p> <% unless contributor_score.resource_num == 0 %>
<div style="display: none" class="numIntro"> 课程资源:<%= contributor_score.resource_num %><br />
资源2<br /> <% end %>
评论98<br /> <% unless contributor_score.message_num == 0 %>
留言12<br /> 课程讨论:<%= contributor_score.message_num %><br />
通知8<br /> <% end %>
</div> <% unless contributor_score.message_reply_num == 0 %>
评论回复:<%= contributor_score.message_reply_num %><br />
</li> <% end %>
<% unless contributor_score.journal_num == 0 %>
<% end %> 课程留言:<%= contributor_score.journal_num %><br />
<div class="cl"></div> <% end %>
</ul> <% unless contributor_score.news_reply_num == 0 %>
<ul class="rankList"> 课程通知:<%= contributor_score.news_reply_num %><br />
<p class="fontGrey2 f14">课程英雄榜</p> <% end %>
<% hero_homework_score(@course, "desc").each do |student_score| %> </div>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a> </li>
<p><a href="javascript:void:(0);"><%=link_to student_score.user, user_path(student_score.user) %></a></p> <% end %>
<p><span class="c_red" style="cursor:pointer" title="作业总分:<%= student_score.score %>"><%= student_score.score.to_i %></span></p>
<!--<div class="numIntro">作业总分:<%#= student_score.score %><br />-->
<!--测验98</div>-->
</li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<% end %>
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
<% unless hero_homework_scores.map(&:score).detect{|s| s != nil}.nil? %>
<ul class="rankList">
<h4>课程英雄榜</h4>
<% hero_homework_scores.each do |student_score| %>
<% unless student_score.score.nil? %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to student_score.user, user_path(student_score.user), :title => student_score.user %></a></p>
<p><span class="c_red" style="cursor:pointer" title="作业总分:<%= student_score.score %>"><%= student_score.score.to_i %></span></p>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>
<div class="project_intro"> <div class="project_intro">
<div id="course_description" class="course_description"> <div id="course_description" class="course_description">
<h4 ><%= l(:label_course_brief_introduction)%></h4> <h4 ><%= l(:label_course_brief_introduction)%></h4>

View File

@ -85,10 +85,24 @@
<div class="homepageLeftMenuBlock"> <div class="homepageLeftMenuBlock">
<%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %> <%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
</div> </div>
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText">项目</a> <div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
<%=link_to "", join_project_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
<!--<div class="courseMenu" id="projectMenu">-->
<!--<ul>-->
<!--<li class="courseMenuIcon" id="projectMenuIcon">-->
<!--<ul class="topnav_course_menu" id="topnav_project_menu" style="line-height:1;">-->
<!--&lt;!&ndash;<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>&ndash;&gt;-->
<!--<li>-->
<!--<%#= link_to "关联项目",join_project_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
<!--</li>-->
<!--</ul>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>--> <!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
</div> </div>
<div class="homepageLeftMenuCourses borderBottomNone"> <div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuProjects">
<ul > <ul >
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%> <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%>
<!--<%#= @organization.org_projects.each do |p|%>--> <!--<%#= @organization.org_projects.each do |p|%>-->
@ -97,10 +111,25 @@
<!--<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>--> <!--<li class="homepageLeftMenuMore"><a href="javascript:void(0);" class="homepageLeftMenuMoreIcon"></a></li>-->
</ul> </ul>
</div> </div>
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText">课程</a> <div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<%=link_to "", join_course_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
<%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>
<!--<div class="courseMenu" id="courseMenu">-->
<!--<ul>-->
<!--<li class="courseMenuIcon" id="courseMenuIcon">-->
<!--<ul class="topnav_course_menu" id="topnav_course_menu" style="line-height:1;">-->
<!--&lt;!&ndash;<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>&ndash;&gt;-->
<!--<li>-->
<!--<%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>-->
<!--</li>-->
<!--</ul>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>--> <!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
</div> </div>
<div class="homepageLeftMenuCourses borderBottomNone"> <div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuCourses">
<ul > <ul >
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%> <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%>
</ul> </ul>
@ -125,6 +154,21 @@
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<script type="text/javascript">
$("#courseMenu").mouseenter(function(){
$("#topnav_course_menu").show();
});
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
$("#projectMenu").mouseenter(function(){
$("#topnav_project_menu").show();
});
$("#projectMenu").mouseleave(function(){
$("#topnav_project_menu").hide();
});
</script>
</body> </body>
</html> </html>

View File

@ -25,13 +25,14 @@
$("#document_title").val(""); $("#document_title").val("");
org_document_description_editor.html(""); org_document_description_editor.html("");
org_document_description_editor.sync(); org_document_description_editor.sync();
$('#org_document_editor').hide(); $('#doc_title_hint').hide(); $('#org_document_editor').hide();
$('#doc_title_hint').hide();
} }
</script> </script>
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %> <%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
<div class="resources"> <div class="resources">
<div> <div>
<input class="postDetailInput fl" maxlength="250" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" placeholder="请输入文章标题" /> <input class="postDetailInput fl" maxlength="250" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题" />
</div> </div>
<div id="doc_title_hint"></div> <div id="doc_title_hint"></div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -17,7 +17,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id),:method => 'put', :id => 'new_org_document_form' do |f| %> <%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag),:method => 'put', :id => 'new_org_document_form' do |f| %>
<div class="resources"> <div class="resources">
<div> <div>
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" /> <input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" />

View File

@ -43,7 +43,7 @@
<% end %> <% end %>
</li> </li>
<li> <li>
<%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :class => "postOptionLink" %> <%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
</li> </li>
<li> <li>
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :method => 'delete', <%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :method => 'delete',

View File

@ -4,4 +4,5 @@
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>'); $("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
$("#principals_for_new_member").html(''); $("#principals_for_new_member").html('');
$("#org_members_count_id").html("<%= @org.org_members.count %>"); $("#org_members_count_id").html("<%= @org.org_members.count %>");
$("#not_org_member_search").val("");
<% end %> <% end %>

View File

@ -0,0 +1,99 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/public.css" rel="stylesheet" type="text/css" />
<link href="css/org.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script>
$(document).ready(function(){
var popupHeight = $(".resourceSharePopup").outerHeight(true);
$(".resourceSharePopup").css("marginTop",-popupHeight/2);
$(".resourcePopupClose").click(function(){
$(".resourceSharePopup").css("display","none");
});
});
</script>
</head>
<body>
<div class="resourceSharePopup">
<div>
<div class="relateText fl">请选择关联到组织的课程</div>
</div>
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>
<div class="fl">
<%=form_tag url_for(:controller => 'organizations', :action => 'join_courses', :organization_id => organization_id),:method => 'post', :id => 'join_courses_form', :remote => true,:class=>"resourcesSearchBox" do %>
<input type="text" name="courses" placeholder="搜索您已加入的课程的名称" class="searchCourse" />
<div id="search_courses_result_list" class="mb8"></div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" onclick="org_join_courses(<%= organization_id %>);" class="sendSourceText">关联</a>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" onclick="cancel_join_courses();" class="sendSourceText">取消</a></div>
<% end %>
</div>
<div class="cl"></div>
<div>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">
var lastSearchCondition = '';
var page = 1;
var count = 0;
var maxPage = 0;
function search_courses(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'organizations', :action => 'search_courses') %>'+'?name='+ e.target.value,
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询组织
$("input[name='courses']").on('input', function (e) {
throttle(search_courses,window,e);
});
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'organizations', :action => 'search_courses') %>',
type:'get'
});
});
function cancel_join_courses() {
$("#join_courses_form input:checked").attr("checked", false);
//$("#search_courses_result_list").html("");
}
function org_join_courses(orgId) {
$.ajax({
url: "/organizations/"+orgId + "/join_courses?" + $("#join_courses_form").serialize(),
type: "post",
success: function (data) {
$.ajax({
url: "/organizations/" + orgId + "/search_courses?name=" + $("input[name='courses']").val().trim(),
type: "get"
});
}
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,95 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/public.css" rel="stylesheet" type="text/css" />
<link href="css/org.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script>
$(document).ready(function(){
var popupHeight = $(".resourceSharePopup").outerHeight(true);
$(".resourceSharePopup").css("marginTop",-popupHeight/2);
$(".resourcePopupClose").click(function(){
$(".resourceSharePopup").css("display","none");
});
});
</script>
</head>
<body>
<div class="resourceSharePopup">
<div>
<div class="relateText fl">请选择关联到组织的项目</div>
</div>
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>
<div class="fl">
<%=form_tag url_for(:controller => 'organizations', :action => 'join_projects', :organization_id => organization_id),:method => 'post', :id => 'join_projects_form', :remote => true,:class=>"resourcesSearchBox" do %>
<input type="text" name="projects" placeholder="搜索您已加入的项目的名称" class="searchCourse" />
<div id="search_projects_result_list" class="mb8"></div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" onclick="org_join_projects(<%= organization_id %>);" class="sendSourceText">关联</a>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" onclick="cancel_join_projects();" class="sendSourceText">取消</a></div>
<% end %>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">
var lastSearchCondition = '';
var page = 1;
var count = 0;
var maxPage = 0;
function search_projects(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'organizations', :action => 'search_projects') %>'+'?name='+ e.target.value,
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询组织
$("input[name='projects']").on('input', function (e) {
throttle(search_projects,window,e);
});
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'organizations', :action => 'search_projects') %>',
type:'get'
});
});
function cancel_join_projects() {
$("#join_projects_form input:checked").attr("checked", false);
//$("#search_projects_result_list").html("");
}
function org_join_projects(orgId) {
$.ajax({
url: "/organizations/"+orgId + "/join_projects?" + $("#join_projects_form").serialize(),
type: "post",
success: function (data) {
$.ajax({
url: "/organizations/" + orgId + "/search_projects?name=" + $("input[name='projects']").val().trim(),
type: "get"
});
}
});
}
</script>
</body>
</html>

View File

@ -56,7 +56,7 @@
<% end %> <% end %>
<% if org_act_count == 10 %> <% if org_act_count == 10 %>
<div id="show_more_activities" class="loadMore mt10 f_grey">展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1),:id => "more_org_activities_link",:remote => "true",:class => "none" %></div> <div id="show_more_activities" class="loadMore mt10 f_grey">展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1, :type => params[:type]),:id => "more_org_activities_link",:remote => "true",:class => "none" %></div>
<%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> <%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%> <% end%>

View File

@ -36,7 +36,7 @@
<% end %> <% end %>
</li> </li>
<li> <li>
<%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :class => "postOptionLink" %> <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 0), :class => "postOptionLink" %>
</li> </li>
<li> <li>
<%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',
@ -87,7 +87,7 @@
</ul> </ul>
</div> </div>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15"> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= act.id %>">
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %> <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer">

View File

@ -0,0 +1,3 @@
$('#topnav_course_menu').hide();
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_course_menu', :locals => {:organization_id => @organization.id}) %>');
$('#ajax-modal').show();

View File

@ -0,0 +1,5 @@
$("#homepageLeftMenuCourses").html("");
$("#homepageLeftMenuCourses").append("<ul>");
$("#homepageLeftMenuCourses").append("<%= escape_javascript(render :partial => 'layouts/org_courses',
:locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>");
$("#homepageLeftMenuCourses").append("</ul>");

View File

@ -0,0 +1,3 @@
$('#topnav_project_menu').hide();
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_project_menu', :locals => {:organization_id => @organization.id}) %>');
$('#ajax-modal').show();

View File

@ -0,0 +1,5 @@
$("#homepageLeftMenuProjects").html("");
$("#homepageLeftMenuProjects").append("<ul>");
$("#homepageLeftMenuProjects").append("<%= escape_javascript(render :partial => 'layouts/org_projects',
:locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>");
$("#homepageLeftMenuProjects").append("</ul>");

View File

@ -0,0 +1,9 @@
$("#search_courses_result_list").html("");
$("#search_courses_result_list").append('<ul class="ml5">');
<% @courses.each do |course|%>
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='courseNames[]' value='<%=course.id%>'/><span class='search_org fl'> <%=course.name %> </span></label></li><div class='cl mt5'></div>";
$("#search_courses_result_list").append(link );
<%end %>
$("#search_courses_result_list").append('</ul>')

View File

@ -0,0 +1,9 @@
$("#search_projects_result_list").html("");
$("#search_projects_result_list").append('<ul class="ml5">');
<% @projects.each do |project|%>
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='projectNames[]' value='<%=project.id%>'/><span class='search_org fl'> <%=project.name %> </span></label></li><div class='cl mt5'></div>";
$("#search_projects_result_list").append(link );
<%end %>
$("#search_projects_result_list").append('</ul>')

View File

@ -67,9 +67,7 @@
}); });
}); });
function cancel_join_orgs() { function cancel_join_orgs() {
$("#search_orgs_result_list").html(""); $("#join_orgs_for_project input:checked").attr("checked", false);
$("#paginator").html("");
$("#paginator").css("display", "none");
} }
function join_org(projectId) { function join_org(projectId) {
$.ajax({ $.ajax({

View File

@ -62,10 +62,13 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function popupRegex(){ function popupRegex(){
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>"); if(regexStudentWorkName()&&regexStudentWorkDescription())
showModal('ajax-modal', '500px'); {
$('#ajax-modal').siblings().remove(); $('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
$('#ajax-modal').parent().css("top","").css("left",""); showModal('ajax-modal', '500px');
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
} }
</script> </script>

View File

@ -121,10 +121,13 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function popupRegex(){ function popupRegex(){
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>"); if(regexStudentWorkName()&&regexStudentWorkDescription())
showModal('ajax-modal', '500px'); {
$('#ajax-modal').siblings().remove(); $('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
$('#ajax-modal').parent().css("top","").css("left",""); showModal('ajax-modal', '500px');
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
} }
</script> </script>

View File

@ -6,8 +6,8 @@
<div class="postBanner" style="padding-bottom:5px;"> <div class="postBanner" style="padding-bottom:5px;">
<span class="linkGrey2 f16">组织列表</span> <span class="linkGrey2 f16">组织列表</span>
<!--<%#= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %>--> <%#= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %>
<!--<input type="text" name="search_orgs" placeholder="输入关键词进行搜索" class="problem_search_input fl"/>--> <!--<input type="text" name="search_orgs" placeholder="输入关键词进行搜索" class="searchResource" />-->
<!--&lt;!&ndash;<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#search_org_form').submit();"></a>&ndash;&gt;--> <!--&lt;!&ndash;<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#search_org_form').submit();"></a>&ndash;&gt;-->
<!--<a href="javascript:void(0);" class="problem_search_btn fl" onclick="$('#search_org_form').submit();">搜索</a>--> <!--<a href="javascript:void(0);" class="problem_search_btn fl" onclick="$('#search_org_form').submit();">搜索</a>-->

View File

@ -2081,7 +2081,7 @@ zh:
label_co_organizer_BHU: 北京航空航天大学 label_co_organizer_BHU: 北京航空航天大学
label_co_organizer_CAS: 中国科学院软件研究所 label_co_organizer_CAS: 中国科学院软件研究所
label_co_organizer_InforS: 中创软件 label_co_organizer_InforS: 中创软件
label_rights_reserved: Copyright 2007~2015, All Rights Riserved label_rights_reserved: Copyright 2007~2015, All Rights Reserved
label_about_us: 关于我们 label_about_us: 关于我们
label_contact_us: 联系我们 label_contact_us: 联系我们
label_recruitment_information: 招聘信息 label_recruitment_information: 招聘信息

View File

@ -39,6 +39,12 @@ RedmineApp::Application.routes.draw do
get 'members' get 'members'
get 'more_org_projects' get 'more_org_projects'
get 'more_org_courses' get 'more_org_courses'
get 'search_courses'
post 'join_course_menu'
post 'join_courses'
get 'search_projects'
post 'join_project_menu'
post 'join_projects'
end end
collection do collection do
get 'check_uniq' get 'check_uniq'

View File

@ -0,0 +1,18 @@
class DeleteUselessOrgActivities < ActiveRecord::Migration
def up
OrgActivity.all.each do |act|
if act.container_type == 'Course'
if CourseActivity.where("course_act_type=? and course_act_id =? and course_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0
act.destroy
end
else
if act.container_type == 'Project' and ForgeActivity.where("forge_act_type=? and forge_act_id =? and project_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0
act.destroy
end
end
end
end
def down
end
end

View File

@ -1,36 +0,0 @@
class AddCourseContributorScore < ActiveRecord::Migration
def up
# course_count = Course.all.count / 30 + 1
# transaction do
# for i in 1 ... course_count do i
Course.all.each do |course|
if course.course_activities.count > 1
course.student.each do |s|
puts course.id
puts course.name
puts s.student_id
# board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is null;").count * 2
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is not null").count * 1
common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.student_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id};").count * 5
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.student_id, course.id, "Course").count * 1
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
if total !=0
CourseContributorScore.create(:course_id => course.id, :user_id => s.student_id, :message_num => board_count, :message_reply_num => message_reply_count,
:news_reply_num => common_reply_count, :resource_num => attachment_count, :journal_num => journal_count, :journal_reply_num => 0, :total => total)
end
end
end
end
# end
# end
end
def down
end
end

View File

@ -0,0 +1,36 @@
class AddCourseContributorTotalScore < ActiveRecord::Migration
def up
# course_count = Course.all.count / 30 + 1
# transaction do
# for i in 1 ... course_count do i
Course.all.each do |course|
if course.course_activities.count > 1
course.student.each do |s|
puts course.id
puts course.name
puts s.student_id
# board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is null;").count * 2
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is not null").count * 1
common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.student_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id};").count * 5
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.student_id, course.id, "Course").count * 1
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
if total !=0
CourseContributorScore.create(:course_id => course.id, :user_id => s.student_id, :message_num => board_count, :message_reply_num => message_reply_count,
:news_reply_num => common_reply_count, :resource_num => attachment_count, :journal_num => journal_count, :journal_reply_num => 0, :total_score => total)
end
end
end
end
# end
# end
end
def down
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151126160252) do ActiveRecord::Schema.define(:version => 20151127011351) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -1151,6 +1151,7 @@ ActiveRecord::Schema.define(:version => 20151126160252) do
create_table "org_members", :force => true do |t| create_table "org_members", :force => true do |t|
t.integer "user_id" t.integer "user_id"
t.integer "organization_id" t.integer "organization_id"
t.string "role"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end

View File

@ -1172,7 +1172,7 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
.courseMenuSetting {background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top:3px; float:right; margin-right:5px;} .courseMenuSetting {background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top:3px; float:right; margin-right:5px;}
.courseMenuSetting:hover {background:url(../images/homepage_icon2.png) -190px -407px no-repeat;} .courseMenuSetting:hover {background:url(../images/homepage_icon2.png) -190px -407px no-repeat;}
.rankList {width:220px; padding:10px; background-color:#ffffff; margin-top:10px;} .rankList {width:220px; padding:10px; background-color:#ffffff; margin-top:10px;}
.rankList li {width:73px; padding:5px 0px; text-align:center; float:left; position:relative;} .rankList li {width:73px; padding:8px 0px 0px 0px; text-align:center; float:left; position:relative;}
.rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;} .rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;}
.rankPortrait {border-radius:50%; width:35px; height:35px;} .rankPortrait {border-radius:50%; width:35px; height:35px;}
.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; width:65px; color:#585858;} .numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;}

View File

@ -384,6 +384,8 @@ a.resourcesGrey:hover {font-size:12px; color:#269ac9;}
a.uploadText {color:#ffffff; font-size:14px;} a.uploadText {color:#ffffff; font-size:14px;}
.resourcesSearchloadBox {border:1px solid #e6e6e6; width:225px; float:left; background-color:#ffffff;} .resourcesSearchloadBox {border:1px solid #e6e6e6; width:225px; float:left; background-color:#ffffff;}
.searchResource {border:none; outline:none; background-color:#ffffff; width:184px; height:32px; padding-left:10px; display:block; float:left;} .searchResource {border:none; outline:none; background-color:#ffffff; width:184px; height:32px; padding-left:10px; display:block; float:left;}
.searchCourse {border:none; outline:none; background-color:#ffffff; width:184px; padding-left:10px; display:block; margin-bottom:15px;}
.searchResource:focus {border:none;}
.searchIcon{width:31px; height:32px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -15px no-repeat; display:block; float:left;} .searchIcon{width:31px; height:32px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -15px no-repeat; display:block; float:left;}
/*.resourcesSearchBanner {height:34px; margin-bottom:10px;}*/ /*.resourcesSearchBanner {height:34px; margin-bottom:10px;}*/
.resourcesSearchBanner {width:710px; height:34px; margin-bottom:10px; margin-top:15px; margin-left:auto; margin-right:auto;} .resourcesSearchBanner {width:710px; height:34px; margin-bottom:10px; margin-top:15px; margin-left:auto; margin-right:auto;}

View File

@ -37,16 +37,21 @@ a.org_member_btn{ padding:1px 5px; background:#15bccf; color:#fff;}
/*项目关联css*/ /*项目关联css*/
.relateOrg {width:335px;} .relateOrg {width:335px;}
.relatedList {width:335px;} .relatedList {width:335px;}
.searchOrg {height:24px; width:200px; color:#9b9b9b9; border:1px solid #15bccf;} .searchOrg {height:24px; width:200px; color:#9b9b9b; border:1px solid #15bccf;}
a.cancelBtn {padding:3px 5px; background-color:#D9D9D9; color:#656565;} a.cancelBtn {padding:3px 5px; background-color:#D9D9D9; color:#656565;}
a.cancelBtn:hover {background-color:#717171; color:#ffffff;} a.cancelBtn:hover {background-color:#717171; color:#ffffff;}
.relatedList ul li {border-bottom:1px solid #e4e4e4; width:320px; height:22px; vertical-align:middle; line-height:22px;} .relatedList ul li {border-bottom:1px solid #e4e4e4; width:320px; height:22px; vertical-align:middle; line-height:22px;}
.relatedListName {width:240px; text-align:left; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;} .relatedListName {width:240px; text-align:left; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;}
.relatedListOption {width:80px; text-align:center;} .relatedListOption {width:80px; text-align:center;}
.relateOrgName {width:240px; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;color:#656565;} .relateOrgName {width:240px; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;color:#656565;}
.search_org {width:150px; max-width:200px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;color:#656565;}
/*组织列表*/ /*组织列表*/
.mt28 {margin-top:28px;} .mt28 {margin-top:28px;}
.orgWrap {width:880px; float:left;} .orgWrap {width:880px; float:left;}
.orgTitle {width:880px; max-width:880px; margin-bottom:5px;word-break: break-all; word-wrap:break-word; } .orgTitle {width:880px; max-width:880px; margin-bottom:5px;word-break: break-all; word-wrap:break-word; }
.orgIntro {width:880px; max-width:880px; margin-bottom:6px; color:#484848;} .orgIntro {width:880px; max-width:880px; margin-bottom:6px; color:#484848;}
/*关联项目弹窗*/
.projectRelate {float:left; max-height:118px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden; width:288px;}
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}