Conflicts:
	app/views/layouts/new_base_user.html.erb
This commit is contained in:
suntao 2015-08-31 14:55:15 +08:00
commit 3e9bb8a596
30 changed files with 447 additions and 142 deletions

View File

@ -365,14 +365,15 @@ class AccountController < ApplicationController
def invalid_credentials
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
flash.now[:error] = l(:notice_account_invalid_creditentials)
render :layout => 'login'
flash[:error] = l(:notice_account_invalid_creditentials)
# render :layout => 'login'
redirect_to signin_path(:login=>true)
end
def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
flash.now[:error] = l(:notice_account_invalid_creditentials_new)
render :layout => 'login'
flash[:error] = l(:notice_account_invalid_creditentials_new)
render signin_path(:login=>true)
end
# Register a user for email activation.

View File

@ -563,7 +563,7 @@ class ApplicationController < ActionController::Base
uri = URI.parse(back_url)
# do not redirect user to another host or to the login or register page
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s)
back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s) if default.is_a?(:User)
redirect_to(back_url)
return
end

View File

@ -96,11 +96,14 @@ class WelcomeController < ApplicationController
@projects = Project.all_public.active
render :layout => false, :content_type => 'text/plain'
end
def course
@course_page = FirstPage.find_by_page_type('course')
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
@logoLink ||= logolink()
redirect_to signin_path
return
#
# @course_page = FirstPage.find_by_page_type('course')
# @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
# @logoLink ||= logolink()
end
def logolink()
@ -140,8 +143,11 @@ class WelcomeController < ApplicationController
def contest
@contest_page = FirstPage.find_by_page_type('contest')
@contest_notifications = Contestnotification.order("created_at desc").limit(5)
redirect_to signin_path
return
# @contest_page = FirstPage.find_by_page_type('contest')
# @contest_notifications = Contestnotification.order("created_at desc").limit(5)
end
def search
@ -181,28 +187,28 @@ class WelcomeController < ApplicationController
private
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
def entry_select
url = request.original_url.gsub('/','')
if url.include?(Setting.url_course.gsub('/',''))
if @first_page.show_course == 1
course
render :course
else
render_404
end
return 0
elsif url.include?(Setting.url_contest.gsub('/',''))
if @first_page.show_contest == 1
contest
render :contest
else
render_404
end
return 0
elsif url.include?(Setting.url_user.gsub('/',''))
#redirect_to(:controller => "users", :action => "index")
end
# url = request.original_url.gsub('/','')
# if url.include?(Setting.url_course.gsub('/',''))
# if @first_page.show_course == 1
# course
# render :course
# else
# render_404
# end
#
# return 0
# elsif url.include?(Setting.url_contest.gsub('/',''))
# if @first_page.show_contest == 1
# contest
# render :contest
# else
# render_404
# end
#
# return 0
# elsif url.include?(Setting.url_user.gsub('/',''))
# #redirect_to(:controller => "users", :action => "index")
# end
end

View File

@ -2254,6 +2254,21 @@ module ApplicationHelper
technical_title
end
def get_user_roll user
technical_title = ""
case user.user_extensions.identity.to_s
when "0"
technical_title = get_technical_title user
when "1"
technical_title = l(:label_account_identity_student)
when "2"
technical_title = l(:label_account_identity_enterprise)
when "3"
technical_title = l(:label_account_identity_developer)
end
technical_title
end
def ie8?
request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/

View File

@ -37,7 +37,8 @@ class Course < ActiveRecord::Base
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
has_many :course_activities
has_many :course_messages
# 课程消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
acts_as_taggable
acts_as_nested_set :order => 'name', :dependent => :destroy

View File

@ -11,6 +11,7 @@ class CourseMessage < ActiveRecord::Base
validates :course_id,presence: true
validates :course_message_id,presence: true
validates :course_message_type, presence: true
validates_length_of :content, :maximum => 100
after_create :add_user_message
def add_user_message

View File

@ -92,7 +92,7 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags'
# 关联虚拟表
has_many :forge_messages
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
belongs_to :organization

View File

@ -1,7 +1,7 @@
<%= stylesheet_link_tag 'new_user'%>
<%= stylesheet_link_tag 'leftside'%>
<script>
<script type="text/javascript">
// $(document).ready(function(){
// $("#loginSignButton").click(function(){
@ -12,6 +12,20 @@
// $("#signUpBox").css({display:"none"});
// $("#loginInBox").css({display:"block"});
// });
// });
// $(function(){
// $("#username").keypress(function(e){
// alert(11);
// if (e.keyCode == '13') {
// $('#main_login_form').submit();
// }
// });
//
// $("#password").keypress(function(e){
// if (e.keyCode == '13') {
// $('#main_login_form').submit();
// }
// });
// });
$(document).ready(function(){
@ -162,6 +176,12 @@
});
});
function user_name_keypress(e){
if (e.keyCode == '13') {
$('#main_login_form').submit();
}
}
</script>
<div class="loginContentContainer">
<div class="loginContent">
@ -186,7 +206,7 @@
<%= back_url_hidden_field_tag %>
<div class="mb20">
<%= text_field_tag 'username', params[:username], :tabindex => '1' ,
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称'%>
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%>
<!--<input type="text" placeholder="请输入邮箱地址或昵称" class="loginSignBox" />-->
</div>
<% if Setting.openid? %>
@ -196,7 +216,7 @@
<% end %>
<div>
<!--<input type="text" placeholder="请输密码" class="loginSignBox" />-->
<%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码'%>
<%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码', :onkeypress => "user_name_keypress(event);"%>
</div>
<div class="loginSignOption">
<% if Setting.autologin? %>

View File

@ -5,7 +5,7 @@
<div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
</div>
<div class="ping_discon upload_img" style="width: 670px;">
<div class="ping_discon upload_img" style="width: 610px;">
<div class="ping_distop f14">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span>

View File

@ -33,12 +33,21 @@
$(function(){
$("#navHomepageSearchInput").keypress(function(e){
if (e.keyCode == '13') {
var name = $.trim($('#navHomepageSearchInput').val());
if (e.keyCode == '13' && name != "" && name.length != 0) {
$('#type').val($('input[type=radio]:checked').val());
$(this).parent().submit();
}
})
});
function search_in_header(obj){
var name = $.trim($('#navHomepageSearchInput').val());
if (name != "" && name.length != 0) {
$('#type').val($('input[type=radio]:checked').val());
obj.parent().submit();
}
}
</script>
<div class="fl" id="navHomepageSearch">
<!--<form class="navHomepageSearchBox">-->
@ -46,9 +55,10 @@
<%= 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="hidden" name="search_type" id="type" value=""/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#type').val($('input[type=radio]:checked').val());$(this).parent().submit();"></a>
<% end %>
<input type="hidden" name="search_type" id="type" value=""/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
<% end %>
<div class="navSearchTypeBox" id="navHomepageSearchType">
<div class="fl mr15 mt8">
<input type="radio" value="courses" name="search_type" checked/>

View File

@ -9,45 +9,53 @@
</li>
</ul>
</div>
<script>
function search(doc){
//alert(1)
// val = $('input:radio[name="search_type"]:checked').val();
// alert(2)
// $("#search_type").val(val);
// alert(3)
$(doc).parent().submit();
}
<% type = type%>
$(function (){
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
$('input:radio[value="courses"]').attr('checked','checked');
}
if('<%= type %>' != null && '<%= type %>' == 'projects' ){
$('input:radio[value="projects"]').attr('checked','checked');
}
if('<%= type %>' != null && '<%= type %>' == 'users' ){
$('input:radio[value="users"]').attr('checked','checked');
}
});
<script>
function search(doc){
//alert(1)
// val = $('input:radio[name="search_type"]:checked').val();
// alert(2)
// $("#search_type").val(val);
// alert(3)
$(doc).parent().submit();
}
<% type = type%>
$(function (){
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
$('input:radio[value="courses"]').attr('checked','checked');
}
if('<%= type %>' != null && '<%= type %>' == 'projects' ){
$('input:radio[value="projects"]').attr('checked','checked');
}
if('<%= type %>' != null && '<%= type %>' == 'users' ){
$('input:radio[value="users"]').attr('checked','checked');
}
});
$(function(){
$("#navHomepageSearchInput").keypress(function(e){
if (e.keyCode == '13') {
$('#type').val($('input[type=radio]:checked').val());
$(this).parent().submit();
}
})
});
</script>
function search_in_header(obj){
var name = $.trim($('#navHomepageSearchInput').val());
if (name != "" && name.length != 0) {
$('#type').val($('input[type=radio]:checked').val());
obj.parent().submit();
}
}
function search_in_header_I(e,obj){
var name = $.trim($('#navHomepageSearchInput').val());
if (e.keyCode == '13' && name != "" && name.length != 0) {
$('#type').val($('input[type=radio]:checked').val());
obj.parent().submit();
}
}
</script>
<div class="fl" id="navHomepageSearch">
<!--<form class="navHomepageSearchBox">-->
<% 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="hidden" name="search_type" id="type" value=""/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#type').val($('input[type=radio]:checked').val());$(this).parent().submit();"></a>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" onkeypress="search_in_header_I(event,$(this));"/>
<input type="hidden" name="search_type" id="type" value=""/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
<% end %>
<div class="navSearchTypeBox" id="navHomepageSearchType">
<div class="fl mr15 mt8">

View File

@ -15,18 +15,6 @@
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
</head>
<script type="text/javascript" charset="utf-8">
$(function() {
$(document).keyup(function (e) {
var e = e || event,
code = e.which || e.keyCode;
if (code == 13 && $("#loginInBox").css('display') == 'block') {
e.preventDefault();
$('#main_login_form').submit();
}
});
});
</script>
<div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>

View File

@ -50,9 +50,11 @@
<span class="<%= @user.user_extensions.gender == 1 ? 'homepageImageSexWomen' : 'homepageImageSexMan' %> "></span>
<% end %>
<div class="cl"></div>
<p class="mb8 c_dark f14">
<%= get_technical_title @user %>
</p>
<% if @user.user_extensions && @user.user_extensions.identity %>
<p class="mb20 c_dark f14">
<%= get_user_roll @user %>
</p>
<% end%>
<div id="watch_user_btn_div">
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
</div>

View File

@ -27,7 +27,7 @@
<%= render :partial => 'attachments/new_form', :locals => {:container => @news} %>
<div class="cl"></div>
</li>
<li class="ml50" >
<li class="ml40" >
<% if is_new %>
<%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>

View File

@ -2,7 +2,7 @@
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<% if @is_teacher%>
<li title="<%= poll.polls_name %>">
<div style="width: 370px;float: left;">
<div style="width: 310px;float: left;">
<% if has_commit %>
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
<% else %>

View File

@ -28,13 +28,18 @@
</div>
<div class="homepagePostDeadline">时间:<%=format_date(activity.created_on) %></div>
</div>
<div class="homepagePostIntro break_word" id="activity_description_<%= user_activity.id %>">缺陷描述:<%= activity.description.html_safe %></div>
<div class="homepagePostIntro break_word" id="activity_description_<%= user_activity.id %>">缺陷描述:
<% if activity.description? %>
<%= textAreailizable activity, :description, :attachments => activity.attachments %>
<% end %>
<%#= activity.description.html_safe %>
</div>
<div class="mt10" style="font-weight:normal;">
<% if activity.attachments.any? %>
<% activity.attachments.each do |attachment| %>
<div class="break_word">
<span title="<%= attachment.filename %>" id="attachment_">
<%= link_to_short_attachment attachment, :class => 'homepagePostFileAtt newsBlue', :download => true -%>
<%= link_to_short_attachment attachment,:length=> 58, :class => 'homepagePostFileAtt newsBlue', :download => true -%>
</span>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
@ -107,8 +112,8 @@
<div class="homepagePostReplyPublisher">
<% if reply.try(:user).try(:realname) == ' ' %>
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<%# else %>
<%#= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_date(reply.created_on) %>

View File

@ -8,7 +8,7 @@
div.ke-toolbar .ke-outline{border:none;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:600px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:555px;margin-top:5px;}
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>

View File

@ -14,7 +14,7 @@
function reset_homework(){
$("#homework_name").val("");
$("#homework_end_time").val("");
$("#homework_end_time").val("<%= (Time.now + 3600 * 24).strftime('%Y-%m-%d')%>");
$("#course_id").val("");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
homework_description_editor.html("");

View File

@ -44,7 +44,7 @@
<%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:title => "#{ma.course_message.title}" %></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.course_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Comment" %>
@ -55,7 +55,7 @@
<%= link_to ma.course_message.comments.html_safe, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:title => "#{ma.course_message.comments.html_safe}" %></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.course_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" %>
@ -64,7 +64,7 @@
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了作业:</span></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),:class => "newsGrey", :title => "#{ma.course_message.name}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.course_message.created_at).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Poll" %>
@ -75,7 +75,7 @@
<%= link_to format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_path(ma.course_message.id),
:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
:title => "#{ma.course_message.polls_name}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.course_message.created_at).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Message" %>
@ -86,7 +86,7 @@
<%=link_to ma.course_message.subject.html_safe, course_boards_path(ma.course_message.course,:parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id,
:topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
:title => "#{ma.course_message.subject.html_safe}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.course_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -107,7 +107,7 @@
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">回复了作品评论:</span></li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id),:class=>"newsGrey",:title => "#{ma.course_message.notes}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.course_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
@ -143,7 +143,7 @@
issue_path(:id => ma.forge_message.journalized_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:title => "#{get_issue_des_update(ma.forge_message).html_safe}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.forge_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.forge_message_type == "Message" %>
@ -156,7 +156,7 @@
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
:topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
:title => "#{ma.forge_message.subject.html_safe}" %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.forge_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.forge_message_type == "News" %>
@ -171,7 +171,7 @@
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ma.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ma.forge_message.id}, :class => "newsGrey", :title => "#{ma.forge_message.title.html_safe}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.forge_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.forge_message_type == "Comment" %>
@ -182,7 +182,7 @@
<li class="homepageNewsContent fl">
<%= link_to "#{ma.forge_message.comments.html_safe}",
{:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.forge_message.comments.html_safe}"%></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.forge_message.created_on).html_safe %> </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>

View File

@ -1,4 +1,5 @@
closeModal();
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
//这里不能将翻页的更新
//这里不能将翻页的更新
$("#res_all_count").html(parseInt($("#res_all_count").html())+1);

View File

@ -0,0 +1,80 @@
# encoding: UTF-8
class ForgeMessages < ActiveRecord::Migration
def up
Project.all.each do |project|
transaction do
project.forge_messages << ForgeMessage.new(:user_id => project.user_id, :project_id => project.id)
# 新闻
project.news.each do |new|
new.project.members.each do |m|
if m.user_id != new.author_id
if m.created_on < new.created_on # 在成员加入项目之后
new.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => new.project_id, :viewed => true)
end
end
end
end
# 新闻回复
project.news.each do |new|
if new.comments
new.comments.each do |comment|
if comment.author_id != comment.commented.author_id
comment.forge_messages << ForgeMessage.new(:user_id => comment.commented.author_id, :project_id => comment.commented.project.id, :viewed => true)
end
end
end
end
# 讨论区
if project.boards.first
project.boards.first.messages.each do |message|
if message.parent_id.nil? # 主贴
message.project.members.each do |m|
if m.user_id != message.author_id
if m.created_on < message.created_on
message.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => message.board.project_id, :viewed => true)
end
end
end
else # 回帖
message.project.members.each do |m|
if m.user_id == Message.find(message.parent_id).author_id && m.user_id != message.author_id # 只针对主贴回复,回复自己的帖子不发消息
if m.created_on < message.created_on
message.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => message.board.project_id, :viewed => true)
end
end
end
end
end
end
# 缺陷
project.issues.each do |issue|
unless issue.author_id == issue.assigned_to_id
issue.forge_messages << ForgeMessage.new(:user_id => issue.assigned_to_id, :project_id => issue.project_id, :viewed => true)
end
end
# 缺陷更新
project.issues.each do |issue|
if issue.journals
issue.journals.each do |journal|
if journal.user_id != journal.issue.author_id
journal.forge_messages << ForgeMessage.new(:user_id => journal.issue.author_id, :project_id => journal.issue.project_id, :viewed => true)
end
if journal.user_id != journal.issue.assigned_to_id && journal.issue.assigned_to_id != journal.issue.author_id # 指派人不是自己的话,则给指派人发送
journal.forge_messages << ForgeMessage.new(:user_id => journal.issue.assigned_to_id, :project_id => journal.issue.project_id, :viewed => true)
end
end
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,115 @@
# encoding: UTF-8
class CourseMessages < ActiveRecord::Migration
def up
Course.all.each do |course|
transaction do
course.course_messages << CourseMessage.new(:user_id => course.tea_id,:course_id => course.id)
# 作业
course.homework_commons.each do |homework_common|
homework_common.course.members.each do |m|
if m.user_id != homework_common.user_id
if m.created_on < homework_common.created_at
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true)
end
end
end
end
# 通知
course.news.each do |new|
new.course.members.each do |m|
if m.user_id != new.author_id
if m.created_on < new.created_on # 在成员加入课程之后
new.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true)
end
end
end
end
# 通知的回复
course.news.each do |new|
if new.comments
new.comments.each do |comment|
if comment.author_id != comment.commented.author_id
comment.course_messages << CourseMessage.new(:user_id => comment.commented.author_id, :course_id => course.id, :viewed => true)
end
end
end
end
# 讨论区
if course.boards.first
course.boards.first.messages.each do |message|
if message.parent_id.nil? # 主贴
message.course.members.each do |m|
if message.author.allowed_to?(:as_teacher, message.course) && m.user_id != message.author_id # 老师 自己的帖子不给自己发送消息
if m.created_on < message.created_on
message.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true)
end
end
end
else # 回帖
message.course.members.each do |m|
if m.user_id == Message.find(message.parent_id).author_id && m.user_id != message.author_id # 只针对主贴回复,回复自己的帖子不发消息
if m.created_on < message.created_on
message.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true)
end
end
end
end
end
end
# 问卷
Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll|
if poll.polls_status == 2 #问卷是发布状态
Course.find(poll.polls_group_id).members.each do |m|
if m.user_id != poll.user_id
if m.created_on < poll.created_at
poll.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => true)
end
end
end
elsif poll.polls_status == 1 #问卷是新建状态
poll.course_messages.destroy_all
end
end
# 作品评阅
# course.homework_commons.each do |homework_common|
# if homework_common.student_works
# homework_common.student_works.each do |student_work|
# if student_work.student_works_scores
# student_work.student_works_scores.each do |student_works_score|
# receiver = student_works_score.student_work.user
# if student_works_score.created_at == student_works_score.updated_at
# if student_works_score.comment.nil?
# student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id,
# :viewed => true, :content => "作业评分:#{student_works_score.score}", :status=> true)
# else
# student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id,
# :viewed => true, :content => "作业评分:#{student_works_score.score}&nbsp;&nbsp;&nbsp; 评语:#{student_works_score.comment}", :status=> true)
# end
# else # 更新
# if student_works_score.comment.nil?
# student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id,
# :viewed => true, :content => "作业评分:#{student_works_score.score}", :status=> true)
# else
# student_works_score.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => course.id,
# :viewed => true, :content => "作业评分:#{student_works_score.score}&nbsp;&nbsp;&nbsp; 评语:#{student_works_score.comment}", :status=> true)
# end
# end
# end
# end
# end
# end
# end
# 作品讨论
end
end
end
def down
end
end

View File

@ -0,0 +1,26 @@
class UpdateMessageTime < ActiveRecord::Migration
def up
course_count = CourseMessage.all.count / 30 + 1
transaction do
for i in 1 ... course_count do i
CourseMessage.page(i).per(30).each do |cmessage|
if cmessage.course_message
if cmessage.course_message.respond_to?("created_at")
cmessage.created_at = cmessage.course_message.created_at
elsif cmessage.course_message.respond_to?("created_on")
cmessage.created_at = cmessage.course_message.created_on
end
cmessage.save
course_all_message = MessageAll.where("message_type = '#{cmessage.class.to_s}' and message_id = '#{cmessage.id}'").first
course_all_message.created_at = cmessage.created_at
course_all_message.save
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,26 @@
class UpdateForgeMessageTime < ActiveRecord::Migration
def up
forge_count = ForgeMessage.all.count / 30 + 1
transaction do
for i in 1 ... forge_count do i
ForgeMessage.page(i).per(30).each do |fmessage|
if fmessage.forge_message
if fmessage.forge_message.respond_to?("created_at")
fmessage.created_at = fmessage.forge_message.created_at
elsif fmessage.forge_message.respond_to?("created_on")
fmessage.created_at = fmessage.forge_message.created_on
end
fmessage.save
forge_all_message = MessageAll.where("message_type = '#{fmessage.class.to_s}' and message_id = '#{fmessage.id}'").first
forge_all_message.created_at = fmessage.created_at
forge_all_message.save
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.
ActiveRecord::Schema.define(:version => 20150826061843) do
ActiveRecord::Schema.define(:version => 20150829070453) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1317,7 +1317,6 @@ ActiveRecord::Schema.define(:version => 20150826061843) do
t.datetime "updated_at", :null => false
t.integer "late_penalty", :default => 0
t.integer "absence_penalty", :default => 0
t.integer "system_score"
end
create_table "student_works_evaluation_distributions", :force => true do |t|
@ -1535,6 +1534,7 @@ ActiveRecord::Schema.define(:version => 20150826061843) do
t.string "identity_url"
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
t.integer "gid"
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"

View File

@ -1,7 +1,7 @@
/*右侧内容--动态*/
.project_r_h{ width:730px; height:40px; background:#eaeaea; margin-bottom:10px;}
.project_r_h02{ width:980px; height:40px; background:#eaeaea; margin-bottom:10px;}
.project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;}
.project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;}
.project_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;}
.project_r_box{ border:1px solid #e2e1e1; width:670px; margin-top:10px;}
.project_h3 { color:#646464; font-size:14px; padding:0 10px; border-bottom:1px solid #e2e1e1;}
@ -52,7 +52,7 @@ a:hover.problem_new_btn{ background:#ff7143; color:#fff;}
.problem_p span{ color:#ff3e00;}
a.problem_pic{ display:block; width:42px; height:42px; padding:3px; border:1px solid #e3e3e3;}
a:hover.problem_pic{border:1px solid #64bdd9;}
.problem_txt{ width:670px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;}
.problem_txt{ width:610px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;}
a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
a:hover.problem_name{ color:#d33503;}
a.problem_tit{ color:#0781b4; max-width:470px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;vertical-align: top;}
@ -105,14 +105,14 @@ a:hover.grey_btn{ background:#717171; color:#fff;}
.w90{width:90px;}
.ml10{margin-left:10px;}
.resource{ width:670px;}
.re_top{width:720px; height:40px; background:#eaeaea; padding:5px;}
.re_top{width:660px; height:40px; background:#eaeaea; padding:5px;}
.re_top input{ float:left;}
.re_search{ margin-top:7px; margin-left:5px;}
.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9; color:#666666;}
.re_schbtn{ width:60px; height:26px; color:#fff; margin-right:5px; border:none; margin-left:0px;padding-left: 0px;}
a.re_fabu { display:block; width:90px; height:30px; font-size:14px; color:#fff; text-align:center; padding-top:10px; }
a:hover.re_fabu{background:#55a1b9;}
.re_con{ margin:5px; width:720px;}
.re_con{ margin:5px; width:665px;}
.re_con_top{color:#494949; }
.re_con_top span{ color:#999999; font-weight:bold;}
a.re_select{ display:block; border:1px solid #ff9900; color:#ff9900; margin-left:10px; padding:1px 5px;}
@ -172,7 +172,7 @@ a:hover.work_edit{color: #fff; background: #64bdd9;}
.wzan a{ display: block;}
a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;}
a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.msg_box{ width:728px; border-bottom:1px dashed #CCC; padding-top:10px;}
.msg_box{ width:670px; border-bottom:1px dashed #CCC; padding-top:10px;}
.msg_box h4{ }
.msg_box textarea{width:658px;height:90px;padding:5px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 0px; color:#666; font-size:12px; }
@ -212,7 +212,7 @@ a:hover.ping_sub{ background:#14a8b9;}
.ping_C{border-bottom:1px dashed #CCC; padding:10px 0 0px;}
.ping_dispic a{ display:block; height:46px; width:46px; border:1px solid #CCC; padding:1px; float:left;}
.ping_dispic a:hover{border:1px solid #15bccf;}
.ping_discon{ float:left; width:670px; margin-left:10px; }
.ping_discon{ float:left; width:610px; margin-left:10px; }
/*.ping_distop span{ float:left;}*/
.ping_distop p{ color:#5f5f5f;word-break: break-all;word-wrap: break-word;}
.ping_disfoot a{ float:right; color: #6883b6; margin-left:5px; margin-bottom:5px;}
@ -221,16 +221,16 @@ a:hover.ping_sub{ background:#14a8b9;}
/* 创建作品 work */
.Newwork{ width:668px; height:418px;}
.N_top{ float:right; margin-left:390px; }
.N_con{ color:#484747; font-weight:bold; width:710px; margin-top:10px; }
.N_con{ color:#484747; font-weight:bold; width:660px; margin-top:10px; }
.N_con p{ }
.w430{ width:470px;}
.w557{ width:557px;}
.w350{ width:350px;}
.h400{height: 400px !important;}
.w620{ width:480px; height:160px; border:1px solid #CCC;}
.bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:530px; }
.bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; }
.bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; }
.hwork_txt{ width:610px; padding-left:5px; background:#fff;}
.hwork_txt{ width:560px; padding-left:5px; background:#fff;}
a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:10px;}
a:hover.tijiao{ background:#0f99a9;}
.members_left{ float:left; width:410px; margin-right:20px; text-align:center;}
@ -556,7 +556,7 @@ a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; pa
/* 20150423作业评分*/
.ml14{ margin-left:14px;}
.w548{ width:600px;}
.w548{ width:552px;}
.w547{ width:544px;}
.w196{ width:182px;}
.w459{ width:459px;}
@ -572,18 +572,18 @@ a:hover.icon_add{background:url(../stylesheets/images/icons.png) -20px -310px no
.w664{ width:664px;}
.w140{ width:140px;}
.talklist_box{ }
.talkmain_box{ width:730px; border-bottom:1px dashed #d9d9d9; margin-bottom:20px; margin-top: 10px;}
.talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; margin-bottom:20px; margin-top: 10px;}
.talkmain_pic{}
a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;}
a:hover.talkmain_pic{border:1px solid #64bdd9;}
.talkmain_txt{ width:670px; margin-left:10px; color:#333;}
.talkmain_txt{ width:610px; margin-left:10px; color:#333;}
a.talkmain_name{ color:#ff5722;}
a:hover.talkmain_name{ color:#d33503;}
.talkmain_tit{ color:#0781b4; width:450px; display:block; }
.talklist_main{ }
/*.talkWrapArrow{ display:block; float:right; margin-right:10px;background:url(../images/arrow.png) 0 0 no-repeat; height:7px; width:13px;}*/
.talkConIpt{ background:#f2f2f2; }
.talkWrapBox{ width:660px; margin-left:60px; }
.talkWrapBox{ width:610px; margin-left:60px; }
.inputFeint{ border:1px solid #d9d9d9; background:#fff; width:583px; height:50px; margin:10px; margin-bottom:5px;color:#666;}
.inputFeint02{ border:1px solid #d9d9d9; background:#fff; width:535px; height:30px; margin:5px 0 5px 50px; color:#666;}
.inputFeint03{ border:1px solid #d9d9d9; background:#fff; width:490px; height:30px; margin:5px 0 5px 0px; color:#666;}
@ -592,7 +592,7 @@ a.Msg_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid
a:hover.Msg_pic{border:1px solid #64bdd9;}
a.Reply_pic{ display:block; width:30px; height:30px; padding:2px; border:1px solid #e3e3e3; float:left;}
a:hover.Reply_pic{border:1px solid #64bdd9;}
.Msg_txt{ float:left; width:630px; margin-left:10px;}
.Msg_txt{ float:left; width:540px; margin-left:10px;}
.Msg_txt p{ }
.talkWrapMsg ul li{border-bottom:1px dashed #d9d9d9; padding-bottom:10px; margin-bottom:10px;}
.talkReply{ width:540px; margin-left:50px; border-top:1px dashed #d9d9d9; padding-top:10px; }
@ -604,7 +604,7 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
/* 20150423作业评分*/
.ml14{ margin-left:14px;}
.w548{ width:600px;}
.w548{ width:552px;}
.w547{ width:544px;}
.w196{ width:196px;}
.w186{ width:186px;}

View File

@ -90,8 +90,8 @@ li.menuArrow:hover {background:url(../images/item.png) -20px -70px no-repeat;}
a.topnav_login_box:hover {color:#a1ebff;}
.navRow1 {margin:0; padding:0;}
.navRow2 {margin:0; padding:0;}
.topnav_login_list{ border:1px solid #269ac9; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;margin-top: -4px;}
.topnav_login_list a{color:#269ac9;}
.topnav_login_list{ border:1px solid #15bccf; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;margin-top: -5px;}
.topnav_login_list a{color:#15bccf;}
.topnav_login_list li{ }
/*底部*/

View File

@ -939,7 +939,7 @@ img.ui-datepicker-trigger {
#attachments_fields input.filename {
border: 0;
height: 1.8em;
width: 630px;
width: 200px;
color: #7f7f7f;
background-color: inherit;
background: url(../images/pic_file.png) 0 3px no-repeat;
@ -954,7 +954,7 @@ img.ui-datepicker-trigger {
.is_public_checkbox{display: none !important;}
.is_public{display: none !important;}
.ui-corner-left{background: #64bdd9;}
.homepagePostIntro img{max-width: 100%;}

View File

@ -7,8 +7,8 @@
/*问卷列表*/
.polls_content{ width:609px;}
.polls_content02{ width:730px;}
.polls_head{ width:730px; height:48px; background:#eaeaea;}
.polls_content02{ width:670px;}
.polls_head{ width:670px; height:48px; background:#eaeaea;}
.polls_head h2{ float:left; font-size:14px; color:#585858; margin:11px 0 0 10px;}
.polls_head span{ font-weight:normal; color:#15bccf;}
a.newbtn{ float:right; display:block; width:80px; height:27px; padding-top:3px; background:#64bdd9; color:#fff; font-size:14px; margin:10px; text-align:center;}
@ -61,7 +61,7 @@ a:hover.ur_button{ background:#0fa9bb; text-decoration:none;}
/*问卷编辑*/
.polls_edit{ color:#767676;}
a:hover{ text-decoration:none; cursor:pointer;}
.tabs{ width:718px; height: auto; border:1px solid #cbcbcb; padding:10px 0 0 10px; margin-bottom:10px;}
.tabs{ width:658px; height: auto; border:1px solid #cbcbcb; padding:10px 0 0 10px; margin-bottom:10px;}
.tab_item { float:left; height:30px; background:#eeeeee; margin-right:4px; padding:0 8px; margin-bottom:10px;}
.icon_delete{ font-size:16px;}
a:hover.icon_delete{ font-weight: bold;}
@ -69,7 +69,7 @@ a:hover.icon_delete{ font-weight: bold;}
.tab_add{float:left; width:22px; height:22px; border:1px solid #cbcbcb; margin-top:6px; }
.icon_page_add{ background:url(images/icons.png) 4px -314px no-repeat; width:22px; height:27px; display:block;}
a:hover.icon_page_add{ background:url(images/icons.png) -16px -314px no-repeat;}
.tab_item02{ float:left; width:154px; height:30px;background:#eeeeee; margin-right:10px; padding:0 10px; margin-bottom:10px; padding:10px 0 0 15px;}
.tab_item02{ float:left; width:139px; height:30px;background:#eeeeee; margin-right:10px; padding:0 10px; margin-bottom:10px; padding:10px 0 0 15px;}
.tab_item02:hover{ background:#c9c9c9;}
.tab_icon{padding-left:25px;}
a:hover.tab_item02{ background:#fff;}
@ -78,9 +78,9 @@ a:hover.tab_item02{ background:#fff;}
.icon_text{background:url(images/icons.png) 0px -80px no-repeat; }
.icon_textarea{background:url(images/icons.png) 0px -121px no-repeat; }
.ur_editor {width:708px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
.ur_editor {width:648px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
.ur_title_editor_title{ margin-bottom:10px;}
.input_title{ width:688px; height:40px; padding:0 10px; text-align:center; font-size:16px; font-weight:bold; background:#fff;border-style:solid; border:1px solid #CBCBCB;}
.input_title{ width:627px; height:40px; padding:0 10px; text-align:center; font-size:16px; font-weight:bold; background:#fff;border-style:solid; border:1px solid #CBCBCB;}
.textarea_editor{ width:627px; height:120px; padding:10px; margin-bottom:10px; background:#fff; border-style:solid; border:1px solid #CBCBCB;}
.btn_submit{ width:56px; height:24px; padding-top:4px;background:#15bccf; color:#fff; text-align:center; display:block; float:left; margin-right:10px;}
a:hover.btn_submit{background:#0fa9bb;}
@ -98,7 +98,7 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
.ur_editor_toolbar{ margin-bottom:10px;}
.ur_editor_toolbar input{ width:40px; height:20px; background:#fff;}
.ur_editor02{width:708px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;}
.ur_editor02{width:648px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;}
a.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; }
a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;}
@ -139,7 +139,7 @@ a:hover.btn_pu{ background:#3cb761;}
.polls_n p{ margin-top:-4px;}
/***新增20150123***/
.ur_buttons{ width:260px; }
.ur_buttons{ width:275px; }
.ur_button_submit{ float:left;}
.polls_cha{float:left; margin-left:15px; margin-top:10px;}

View File

@ -225,7 +225,7 @@ a:hover.blue_n_btn{ background:#329cbd;}
/*框架主类容*/
#Container{ width:1000px; margin:0 auto; }
#Container{ width:940px; margin:0 auto; }
/*头部导航*/
#Header{ margin:10px 0; background:#15bccf; height:40px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
@ -291,7 +291,7 @@ a:hover.search_btn{ background: #0fa9bb;}
.search_text{ border:1px solid #15bccf; background:#fff; width:220px; height:25px; padding-left:5px; }
/*主类容左右分栏*/
#LSide{ width:240px; }
#RSide{ width:730px; margin-left:10px; background:#fff; padding:10px; margin-bottom:10px;}
#RSide{ width:670px; margin-left:10px; background:#fff; padding:10px; margin-bottom:10px;}
/*底部*/