Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
9ca1234324
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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? %>
|
||||
|
|
|
@ -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" class="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/>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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? %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo">
|
||||
<div class="homepagePostTo mb12">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
|
@ -15,7 +15,7 @@
|
|||
<%= link_to activity.course.name.to_s+"(课程名称)", course_path(activity.container_id), :class => "newsBlue ml15", :style=>"word-break:break-all" %>
|
||||
<!--<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a>-->
|
||||
</div>
|
||||
<div class="homepagePostTitle">
|
||||
<div class="homepagePostTitle mb12">
|
||||
<a href="javascript:void(0);" class="postGrey"><%=activity.filename.to_s(附件名称)%></a>
|
||||
</div>
|
||||
<div class="homepagePostSubmitContainer">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="resources mt10">
|
||||
<div class="homepagePostBrief" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostBrief mt10" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostPortrait">
|
||||
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a></div>
|
||||
<div class="homepagePostDes">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="resources mt10">
|
||||
<div class="homepagePostBrief" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostBrief mt10" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostPortrait">
|
||||
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a></div>
|
||||
<div class="homepagePostDes">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="resources mt10">
|
||||
<div class="homepagePostBrief" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostBrief mt10" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostPortrait">
|
||||
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a></div>
|
||||
<div class="homepagePostDes">
|
||||
|
|
|
@ -107,8 +107,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) %>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="resources mt10">
|
||||
<div class="homepagePostBrief" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostBrief mt10" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
|
||||
<div class="homepagePostPortrait">
|
||||
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a></div>
|
||||
<div class="homepagePostDes">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="resources mt10">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostBrief mt10">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
|
|
@ -138,10 +138,10 @@
|
|||
<div class="homepagePostPortrait">
|
||||
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a></div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
|
||||
<div class="homepagePostTo mb12"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
|
||||
<a href="javascript:void(0);" class="newsBlue ml15 mr5">黄井泉</a><span class="c_blue">,</span><a href="javascript:void(0);" class="newsBlue ml5">陈正东</a>
|
||||
</div>
|
||||
<div class="homepagePostTitle"><a href="javascript:void(0);" class="postGrey">假期开心吗?(讨论区内容)</a></div>
|
||||
<div class="homepagePostTitle mb12"><a href="javascript:void(0);" class="postGrey">假期开心吗?(讨论区内容)</a></div>
|
||||
<div class="homepagePostSubmitContainer">
|
||||
<div class="homepagePostDeadline">时间:2015-07-31</div>
|
||||
</div>
|
||||
|
@ -205,9 +205,9 @@
|
|||
<div class="homepagePostPortrait">
|
||||
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a></div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
|
||||
<div class="homepagePostTo mb12"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
|
||||
<a href="javascript:void(0);" class="newsBlue ml15">Trustie Forge(项目名称)</a></div>
|
||||
<div class="homepagePostTitle">
|
||||
<div class="homepagePostTitle mb12">
|
||||
<a href="javascript:void(0);" class="postGrey">上传资源未显示在项目动态中(缺陷标题)</a><span class="homepagePostProjectState">正常</span>
|
||||
</div>
|
||||
<div class="homepagePostSubmitContainer">
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -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
|
|
@ -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} 评语:#{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} 评语:#{student_works_score.comment}", :status=> true)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# 作品讨论
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -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
|
|
@ -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
|
|
@ -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"
|
||||
|
|
|
@ -938,7 +938,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;
|
||||
|
|
Loading…
Reference in New Issue