merge
This commit is contained in:
commit
bacb5f859b
|
@ -67,6 +67,14 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
# 消息状态更新
|
||||
@homework.course_messages.each do |homework_message|
|
||||
if User.current.id == homework_message.user_id
|
||||
homework_message.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
|
||||
# 消息end
|
||||
#设置作业对应的forge_messages表的viewed字段
|
||||
query_student_work = @homework.course_messages
|
||||
query_student_work.each do |query|
|
||||
|
@ -159,10 +167,14 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
def new
|
||||
redirect_to new_user_commit_homework_users_path(homework_id: @homework.id) if @homework.homework_type==2
|
||||
@user = User.current
|
||||
@student_work = @homework.student_works.where("user_id = ?",User.current.id).first
|
||||
if @student_work.nil?
|
||||
@student_work = StudentWork.new
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{ render :layout => "new_base_user"}
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -203,11 +215,12 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
@user = User.current
|
||||
if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业
|
||||
render_403
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.html{ render :layout => "new_base_user"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -106,15 +106,17 @@ class UsersController < ApplicationController
|
|||
return
|
||||
end
|
||||
# 当前用户查看消息,则设置消息为已读
|
||||
course_querys = @user.course_messages
|
||||
forge_querys = @user.forge_messages
|
||||
user_querys = @user.user_feedback_messages
|
||||
forum_querys = @user.memo_messages
|
||||
if User.current.id == @user.id
|
||||
course_querys.update_all(:viewed => true)
|
||||
forge_querys.update_all(:viewed => true)
|
||||
user_querys.update_all(:viewed => true)
|
||||
forum_querys.update_all(:viewed => true)
|
||||
if params[:viewed] == "all"
|
||||
course_querys = @user.course_messages
|
||||
forge_querys = @user.forge_messages
|
||||
user_querys = @user.user_feedback_messages
|
||||
forum_querys = @user.memo_messages
|
||||
if User.current.id == @user.id
|
||||
course_querys.update_all(:viewed => true)
|
||||
forge_querys.update_all(:viewed => true)
|
||||
user_querys.update_all(:viewed => true)
|
||||
forum_querys.update_all(:viewed => true)
|
||||
end
|
||||
end
|
||||
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
||||
case params[:type]
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# encoding: utf-8
|
||||
include UserScoreHelper
|
||||
|
||||
module StudentWorkHelper
|
||||
def user_projects_option
|
||||
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% project = project %>
|
||||
<span class="add_attachment" style="font-weight:normal;">
|
||||
<%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn', :style => ie8? ? 'display:none' : '' %>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
|
||||
div.recall_con{width:570px;}
|
||||
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
|
||||
.ke-container{height: 80px !important;}
|
||||
</style>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
|
||||
<script >
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
<%= homework_anonymous_comment(homework)%>
|
||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
|
||||
<%#= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %>
|
||||
<%= link_to(l(:button_edit),"javascript:void(0)", :class => "fr mr10 un_work_edit",:title => "编辑功能正在维护中") %>
|
||||
<% elsif @is_student%>
|
||||
<%= student_anonymous_comment homework %>
|
||||
<%= student_new_homework homework %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<li class="fl"><a href="<%= agreement_path %>" class="f_grey mw20" target="_blank">服务协议</a>|</li>
|
||||
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
|
||||
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
|
||||
<li class="fl"><span class="f_grey mw20" title="暂未开放"><%= l(:label_forums)%></span></li>
|
||||
<li class="fl"><a href="<%= forums_path %>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,52 +1,54 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">编辑作品</h2>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<%= labelled_form_for @work,:html => { :multipart => true } do |f|%>
|
||||
<div class="N_con">
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<input type="text" name="student_work[name]" id="student_work_name" class="bo fl" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >项目信息
|
||||
<img class="ml5 " src="/images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<div class="HomeWork" id="RSide">
|
||||
<div class="RightBanner">
|
||||
<div class="NewsBannerName">编辑作品</div>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<%= labelled_form_for @work,:html => { :multipart => true } do |f|%>
|
||||
<div class="N_con">
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<input type="text" name="student_work[name]" id="student_work_name" class="bo fl" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >项目信息
|
||||
<img class="ml5 " src="/images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
|
||||
<p id="about_project" class="about_project" style="<%= @work.project.nil? ? '' : 'display:block;'%>">
|
||||
<label class="fl"> 关联项目 :</label>
|
||||
<%= f.select :project,options_for_select(user_projects_option,@work.project_id), {},{:class => "bo02 mb10"} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p id="about_project" class="about_project" style="<%= @work.project.nil? ? '' : 'display:block;'%>">
|
||||
<label class="fl"> 关联项目 :</label>
|
||||
<%= f.select :project,options_for_select(user_projects_option,@work.project_id), {},{:class => "bo02 mb10"} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
|
||||
<p>
|
||||
<label class="fl">
|
||||
<span class="c_red">*</span>
|
||||
作品描述 :
|
||||
</label>
|
||||
<textarea name="student_work[description]" placeholder="最多3000个汉字(或6000个英文字符)" id="student_work_description" class="w620 hwork_txt" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
|
||||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form',:locals => {:container => @work} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml80 ">
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="edit_student_work(<%= @work.id%>);">提交作品</a>
|
||||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
<% end%>
|
||||
<p>
|
||||
<label class="fl">
|
||||
<span class="c_red">*</span>
|
||||
作品描述 :
|
||||
</label>
|
||||
<textarea name="student_work[description]" placeholder="最多3000个汉字(或6000个英文字符)" id="student_work_description" class="w620 hwork_txt" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
|
||||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form',:locals => {:container => @work} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml80 ">
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white mt10" onclick="edit_student_work(<%= @work.id%>);">提交作品</a>
|
||||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white mt10 ml10"%>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
<% end%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--新建作业结束-->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -124,7 +124,6 @@
|
|||
</h4>
|
||||
<% if @is_teacher%>
|
||||
<%= homework_anonymous_comment(@homework)%>
|
||||
<%= link_to(l(:button_edit),"javascript:void(0)", :class => "fr mr10 un_work_edit",:title => "编辑功能正在维护中") %>
|
||||
<% else%>
|
||||
<%= student_anonymous_comment @homework %>
|
||||
<%= student_new_homework @homework %>
|
||||
|
|
|
@ -17,75 +17,77 @@
|
|||
});
|
||||
<% end%>
|
||||
</script>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">创建作品</h2>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<%= form_for(@student_work,
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'student_work',
|
||||
:action => 'create',
|
||||
:homework => @homework.id
|
||||
}) do |f|%>
|
||||
<div class="N_con">
|
||||
<% if @homework.homework_type == 1%>
|
||||
<div class=" c_red mb10 ml90">
|
||||
提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息
|
||||
</div>
|
||||
<div class="HomeWork" id="RSide">
|
||||
<div class="RightBanner">
|
||||
<div class="NewsBannerName">提交作品</div>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<%= form_for(@student_work,
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'student_work',
|
||||
:action => 'create',
|
||||
:homework => @homework.id
|
||||
}) do |f|%>
|
||||
<div class="N_con">
|
||||
<% if @homework.homework_type == 1%>
|
||||
<div class=" c_red mb10 ml90">
|
||||
提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息
|
||||
</div>
|
||||
<% end%>
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
|
||||
<% if @homework.homework_type != 2%>
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick=" $('#about_project').slideToggle();" >
|
||||
项目信息
|
||||
<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p id="about_project" class="about_project" >
|
||||
<label class="fl"> 选择项目 :</label>
|
||||
<%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl">
|
||||
<span class="c_red">*</span>
|
||||
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
|
||||
:
|
||||
</label>
|
||||
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%>
|
||||
<% else %>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% if @homework.homework_type != 2%>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form' %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
<p class="ml80 ">
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white mt10" onclick="new_student_work();">提交作品</a>
|
||||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white mt10 ml10"%>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
<% end%>
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
|
||||
<% if @homework.homework_type != 2%>
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >
|
||||
项目信息
|
||||
<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p id="about_project" class="about_project" >
|
||||
<label class="fl"> 选择项目 :</label>
|
||||
<%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl">
|
||||
<span class="c_red">*</span>
|
||||
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
|
||||
:
|
||||
</label>
|
||||
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%>
|
||||
<% else %>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% if @homework.homework_type != 2%>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form' %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
<p class="ml80 ">
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="new_student_work();">提交作品</a>
|
||||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--新建作业结束-->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--新建作业结束-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<% else %>
|
||||
|
||||
|
@ -125,8 +127,8 @@
|
|||
</script>
|
||||
<!-- 模板1结束 -->
|
||||
|
||||
<div class="homepageRight">
|
||||
<div class="HomeWork">
|
||||
|
||||
<div class="HomeWork" id="RSide">
|
||||
<div class="RightBanner">
|
||||
<div class="NewsBannerName">提交作品</div>
|
||||
</div>
|
||||
|
@ -201,6 +203,5 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</div><!----ProResult end-->
|
||||
</div><!--homepageRight end-->
|
||||
|
||||
<% end %>
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
</div>
|
||||
<div class="resources mt10" id="users_setting">
|
||||
<div>
|
||||
<% if params[:type].nil? %>
|
||||
<div class="newsReadSetting">
|
||||
有 <span class="c_red"><%= User.current.count_new_message %></span> 条未读<a href="javascript:void(0);" class="ml15"><%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @message_alls.count >0 %>
|
||||
<%# 课程消息 %>
|
||||
<% unless @message_alls.nil? %>
|
||||
|
@ -52,7 +57,11 @@
|
|||
<li class="homepageNewsContent fl">
|
||||
<%= 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>
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></li>
|
||||
<div style="display: none" class="message_title">
|
||||
<%= ma.course_message.comments.html_safe %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -80,11 +89,21 @@
|
|||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %></a></li>
|
||||
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.parent_id.nil? ? ma.course_message.subject.html_safe : ma.course_message.content.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>
|
||||
<% if ma.course_message.parent_id.nil? %>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.subject, 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>
|
||||
<% else %>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.content.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"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></a></li>
|
||||
<div style="display: none" class="message_title" >
|
||||
<%= ma.course_message.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
|
||||
</ul>
|
||||
|
@ -150,11 +169,23 @@
|
|||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %></a></li>
|
||||
<li class="homepageNewsPubType fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %></span></li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%=link_to ma.forge_message.parent_id.nil? ? ma.forge_message.subject.html_safe : ma.forge_message.content.html_safe, project_boards_path(ma.forge_message.project,
|
||||
: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>
|
||||
<% if ma.forge_message.parent_id.nil? %>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%=link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project,
|
||||
: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>
|
||||
<% else %>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%=link_to ma.forge_message.content.html_safe, project_boards_path(ma.forge_message.project,
|
||||
: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"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></a></li>
|
||||
<div style="display: none" class="message_title">
|
||||
<%= ma.forge_message.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -180,7 +211,9 @@
|
|||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了新闻:</span></li>
|
||||
<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>
|
||||
{: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.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -196,9 +229,21 @@
|
|||
<%=link_to ma.memo.author, user_path(ma.memo.author), :class => "newsBlue homepageNewsPublisher" %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>" ><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %></span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content}" %></a>
|
||||
</li>
|
||||
<% if ma.memo.parent_id.nil? %>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.memo.subject, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
||||
:title => "#{ma.memo.subject}" %></a>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.memo.content.html_safe, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||
</li>
|
||||
<div style="display: none" class="message_title">
|
||||
<%= ma.memo.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.memo.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -215,8 +260,13 @@
|
|||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.journals_for_message.notes}" %></a>
|
||||
<%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||
</li>
|
||||
<div style="display: none" class="message_title" >
|
||||
<%= ma.journals_for_message.notes.html_safe %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.journals_for_message.created_on).html_safe %> </li>
|
||||
|
||||
</ul>
|
||||
|
@ -236,6 +286,17 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function message_titile_show(obj,e)
|
||||
{
|
||||
obj.parent().next("div").show();
|
||||
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
|
||||
}
|
||||
function message_titile_hide(obj)
|
||||
{
|
||||
obj.parent().next("div").hide();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
div.ke-toolbar .ke-outline{border:none;}
|
||||
.ke-container{height: 80px !important;}
|
||||
</style>
|
||||
<div >
|
||||
<div class="homepageRightBanner mb10">
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
# 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
|
||||
# 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
|
||||
|
|
|
@ -1,79 +1,80 @@
|
|||
# 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.all.each do |course|
|
||||
# transaction do
|
||||
# put course.id
|
||||
# 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|
|
||||
|
@ -106,8 +107,8 @@ class CourseMessages < ActiveRecord::Migration
|
|||
# end
|
||||
# 作品讨论
|
||||
|
||||
end
|
||||
end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
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
|
||||
# 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
|
||||
# puts cmessage.id
|
||||
#
|
||||
# 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
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
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
|
||||
# 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
|
||||
# puts fmessage.id
|
||||
#
|
||||
# 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
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
class AboutMemoMessage < ActiveRecord::Migration
|
||||
def up
|
||||
Memo.all.each do |memo|
|
||||
transaction do
|
||||
# 贴吧帖子
|
||||
receivers = []
|
||||
u = User.find(6)
|
||||
receivers << u
|
||||
# 主贴
|
||||
if memo.parent_id.nil?
|
||||
if memo.author_id != memo.forum.creator_id # 发帖人不是吧主
|
||||
receivers << memo.forum.creator
|
||||
end
|
||||
else # 回帖
|
||||
# 添加吧主
|
||||
if memo.author_id != memo.forum.creator_id
|
||||
receivers << memo.forum.creator
|
||||
end
|
||||
# 添加发帖人
|
||||
unless memo.parent.nil?
|
||||
if memo.author_id != memo.parent.author_id
|
||||
receivers << memo.parent.author
|
||||
puts memo.id
|
||||
end
|
||||
end
|
||||
end
|
||||
receivers.each do |r|
|
||||
memo.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => memo.forum_id, :memo_id => memo.id, :memo_type => "Memo", :viewed => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
# Memo.all.each do |memo|
|
||||
# transaction do
|
||||
# # 贴吧帖子
|
||||
# receivers = []
|
||||
# u = User.find(6)
|
||||
# receivers << u
|
||||
# # 主贴
|
||||
# if memo.parent_id.nil?
|
||||
# if memo.author_id != memo.forum.creator_id # 发帖人不是吧主
|
||||
# receivers << memo.forum.creator
|
||||
# end
|
||||
# else # 回帖
|
||||
# # 添加吧主
|
||||
# if memo.author_id != memo.forum.creator_id
|
||||
# receivers << memo.forum.creator
|
||||
# end
|
||||
# # 添加发帖人
|
||||
# unless memo.parent.nil?
|
||||
# if memo.author_id != memo.parent.author_id
|
||||
# receivers << memo.parent.author
|
||||
# puts memo.id
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# receivers.each do |r|
|
||||
# memo.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => memo.forum_id, :memo_id => memo.id, :memo_type => "Memo", :viewed => true)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
class AboutUserFeedbackMessage < ActiveRecord::Migration
|
||||
def up
|
||||
JournalsForMessage.all.each do |jour_for_message|
|
||||
transaction do
|
||||
# 主留言
|
||||
if jour_for_message.jour_type == 'Principal'
|
||||
receivers = []
|
||||
if jour_for_message.reply_id == 0
|
||||
if jour_for_message.user_id != jour_for_message.jour_id # 过滤自己给自己的留言消息
|
||||
receivers << jour_for_message.jour
|
||||
end
|
||||
else # 留言回复
|
||||
reply_to = User.find(jour_for_message.reply_id)
|
||||
if jour_for_message.user_id != jour_for_message.reply_id # 添加我回复的那个人
|
||||
receivers << reply_to
|
||||
end
|
||||
unless jour_for_message.parent.nil?
|
||||
if jour_for_message.user_id != jour_for_message.parent.jour_id && jour_for_message.reply_id != jour_for_message.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发
|
||||
receivers << jour_for_message.parent.jour
|
||||
end
|
||||
end
|
||||
end
|
||||
unless receivers.blank?
|
||||
receivers.each do |r|
|
||||
puts jour_for_message.id
|
||||
jour_for_message.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => jour_for_message.id, :journals_for_message_type => "Principal", :viewed => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# JournalsForMessage.all.each do |jour_for_message|
|
||||
# transaction do
|
||||
# # 主留言
|
||||
# if jour_for_message.jour_type == 'Principal'
|
||||
# receivers = []
|
||||
# if jour_for_message.reply_id == 0
|
||||
# if jour_for_message.user_id != jour_for_message.jour_id # 过滤自己给自己的留言消息
|
||||
# receivers << jour_for_message.jour
|
||||
# end
|
||||
# else # 留言回复
|
||||
# reply_to = User.find(jour_for_message.reply_id)
|
||||
# if jour_for_message.user_id != jour_for_message.reply_id # 添加我回复的那个人
|
||||
# receivers << reply_to
|
||||
# end
|
||||
# unless jour_for_message.parent.nil?
|
||||
# if jour_for_message.user_id != jour_for_message.parent.jour_id && jour_for_message.reply_id != jour_for_message.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发
|
||||
# receivers << jour_for_message.parent.jour
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# unless receivers.blank?
|
||||
# receivers.each do |r|
|
||||
# puts jour_for_message.id
|
||||
# jour_for_message.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => jour_for_message.id, :journals_for_message_type => "Principal", :viewed => true)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
class UpdateMemoMessageTime < ActiveRecord::Migration
|
||||
def up
|
||||
memo_count = Memo.all.count / 30 + 1
|
||||
transaction do
|
||||
for i in 1 ... memo_count do i
|
||||
MemoMessage.page(i).per(30).each do |memo_message|
|
||||
if memo_message.memo
|
||||
if memo_message.memo.respond_to?("created_at")
|
||||
memo_message.created_at = memo_message.memo.created_at
|
||||
elsif memo_message.memo.respond_to?("created_on")
|
||||
memo_message.created_at = memo_message.memo.created_on
|
||||
end
|
||||
memo_message.save
|
||||
|
||||
memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first
|
||||
memo_messages.created_at = memo_message.created_at
|
||||
memo_messages.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# memo_count = Memo.all.count / 30 + 1
|
||||
# transaction do
|
||||
# for i in 1 ... memo_count do i
|
||||
# MemoMessage.page(i).per(30).each do |memo_message|
|
||||
# if memo_message.memo
|
||||
# if memo_message.memo.respond_to?("created_at")
|
||||
# memo_message.created_at = memo_message.memo.created_at
|
||||
# elsif memo_message.memo.respond_to?("created_on")
|
||||
# memo_message.created_at = memo_message.memo.created_on
|
||||
# end
|
||||
# memo_message.save
|
||||
# puts memo_message.id
|
||||
#
|
||||
# memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first
|
||||
# memo_messages.created_at = memo_message.created_at
|
||||
# memo_messages.save
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
class UpdateUserfeebackMessageTime < ActiveRecord::Migration
|
||||
def up
|
||||
user_feedback_count = UserFeedbackMessage.all.count / 30 + 1
|
||||
transaction do
|
||||
for i in 1 ... user_feedback_count do i
|
||||
UserFeedbackMessage.page(i).per(30).each do |ufm|
|
||||
if ufm.journals_for_message
|
||||
if ufm.journals_for_message.respond_to?("created_at")
|
||||
ufm.created_at = ufm.journals_for_message.created_at
|
||||
elsif ufm.journals_for_message.respond_to?("created_on")
|
||||
ufm.created_at = ufm.journals_for_message.created_on
|
||||
end
|
||||
puts ufm.id
|
||||
ufm.save
|
||||
|
||||
user_feedback_messages = MessageAll.where("message_type = '#{ufm.class.to_s}' and message_id = '#{ufm.id}'").first
|
||||
user_feedback_messages.created_at = ufm.created_at
|
||||
user_feedback_messages.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# user_feedback_count = UserFeedbackMessage.all.count / 30 + 1
|
||||
# transaction do
|
||||
# for i in 1 ... user_feedback_count do i
|
||||
# UserFeedbackMessage.page(i).per(30).each do |ufm|
|
||||
# if ufm.journals_for_message
|
||||
# if ufm.journals_for_message.respond_to?("created_at")
|
||||
# ufm.created_at = ufm.journals_for_message.created_at
|
||||
# elsif ufm.journals_for_message.respond_to?("created_on")
|
||||
# ufm.created_at = ufm.journals_for_message.created_on
|
||||
# end
|
||||
# puts ufm.id
|
||||
# ufm.save
|
||||
#
|
||||
# user_feedback_messages = MessageAll.where("message_type = '#{ufm.class.to_s}' and message_id = '#{ufm.id}'").first
|
||||
# user_feedback_messages.created_at = ufm.created_at
|
||||
# user_feedback_messages.save
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function init_editor(params){
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 0,minWidth:"1px",width:"100%",minHeight:"40px",
|
||||
resizeType : 1,minWidth:"1px",width:"100%",height:"80px",
|
||||
items:['emoticons'],
|
||||
afterChange:function(){//按键事件
|
||||
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
|
|
|
@ -131,4 +131,50 @@ function search_homework_by_name(url){
|
|||
function (data) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//提交新建作品
|
||||
function new_student_work()
|
||||
{
|
||||
if(regexStudentWorkName()&®exStudentWorkDescription())
|
||||
{$("#new_student_work").submit();}
|
||||
}
|
||||
|
||||
function edit_student_work(id)
|
||||
{
|
||||
if(regexStudentWorkName()&®exStudentWorkDescription())
|
||||
{$("#edit_student_work_" + id).submit();}
|
||||
}
|
||||
|
||||
//验证作品名称
|
||||
function regexStudentWorkName()
|
||||
{
|
||||
var name = $.trim($("#student_work_name").val());
|
||||
|
||||
if(name=="")
|
||||
{
|
||||
$("#student_work_name_span").text("作品名称不能为空");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#student_work_name_span").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function regexStudentWorkDescription()
|
||||
{
|
||||
var name = $.trim($("#student_work_description").val());
|
||||
|
||||
if(name=="")
|
||||
{
|
||||
$("#student_work_description_textarea").text("作品描述不能为空");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#student_work_description_textarea").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -187,7 +187,7 @@ a:hover.grey_n_btn{ background:#717171; color:#fff;}
|
|||
.green_btn{ background:#28be6c; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;}
|
||||
a.green_btn{background:#28be6c;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
|
||||
a:hover.green_btn{ background:#14ad5a;}
|
||||
.blue_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;}
|
||||
.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;}
|
||||
a.blue_btn{background:#64bdd9;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
|
||||
a:hover.blue_btn{ background:#329cbd;}
|
||||
a.orange_btn{ background:#ff5722;color:#fff; font-weight:normal; padding:2px 10px; text-align:center; }
|
||||
|
@ -525,7 +525,7 @@ a.replyGrey1 {color:#888888;}
|
|||
a.replyGrey1:hover {color:#4b4b4b;}
|
||||
a.newsBlue {color:#269ac9;}
|
||||
a.newsBlue:hover {color:#297fb8;}
|
||||
a.newsBlack {color:#000000; font-size:13px; font-weight:bold}
|
||||
a.newsBlack {color:#4b4b4b; font-size:13px; font-weight:bold}
|
||||
a.menuGrey {color:#808080;}
|
||||
a.menuGrey:hover {color:#fe7d68;}
|
||||
.navSearchTypeBox {width:368px; height:35px; position:absolute; border:1px solid #e1e1e1; background-color:#ffffff; padding-left:10px; display:none; color:#3e3e3e; font-size:14px;}
|
||||
|
@ -925,6 +925,7 @@ img.ui-datepicker-trigger {
|
|||
text-overflow: ellipsis;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.message_title{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;}
|
||||
.description{display: none !important;}
|
||||
.ispublic-label{display: none !important;}
|
||||
.is_public_checkbox{display: none !important;}
|
||||
|
@ -953,3 +954,50 @@ blockquote {
|
|||
background-color: #e8e8e8;
|
||||
}
|
||||
|
||||
/* 创建作品 work */
|
||||
.Newwork{ width:668px; height:418px;}
|
||||
.N_top{ float:right; margin-left:390px; }
|
||||
.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:470px; }
|
||||
.bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; }
|
||||
.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;}
|
||||
.members_left{}
|
||||
.members_left ul li{ height:30px; border-bottom:1px solid #E4E4E4; width:410px; padding-top:10px; }
|
||||
.members_left ul li a{ float:left; text-align:center;}
|
||||
.members_left ul li span{ float:left; text-align:center; color:#484747;}
|
||||
.w150{ text-align:center; width:150px;min-height: 10px;}
|
||||
.f_b{ font-weight: bold;}
|
||||
.members_right label{ margin-left:15px;}
|
||||
.N_search{ height:20px; border:1px solid #999;}
|
||||
/* 创建作品 homework */
|
||||
.hwork_new{ color:#4c4c4c;}
|
||||
.c_red{ color:#F00;}
|
||||
.hwork_input{ border:1px solid #64bdd9; height:22px; width:88%; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_input02{ border:1px solid #64bdd9; height:15px; width:140px; background:#fff; margin-bottom:10px; padding:5px;}
|
||||
.hwork_text{ border:1px solid #64bdd9; height:100px;width:555px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
|
||||
.hwork_new ul li{ }
|
||||
.ml21{ margin-left:21px;}
|
||||
.ml9{ margin-left:9px;}
|
||||
.hwork_ttl{height:24px;}
|
||||
.hwork_ctt{height:auto; padding-left:10px;clear:both;}
|
||||
.hwork_tb_{ border-bottom:3px solid #e4e4e4; text-align:center;}
|
||||
.hwork_tb_ ul{height:24px;}
|
||||
.hwork_tb_ li{float:left;height: 24px;width: auto; padding:0 10px;cursor:pointer;}
|
||||
.hwork_normaltab { color:#15bccf ; border-bottom:3px solid #e4e4e4; }
|
||||
.hwork_hovertab { color:#656767; font-weight:bold; border-bottom:3px solid #15bccf; }
|
||||
|
||||
.hwork_dis{display:block; }
|
||||
.hwork_undis{display:none;}
|
||||
.project_none{ display:none;}
|
||||
.about_project{ overflow:hidden;display:none;}
|
||||
.project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;}
|
||||
.project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;}
|
||||
|
|
|
@ -391,16 +391,17 @@ blockquote {
|
|||
border-right: 1px solid #e0e0e0;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
padding-left: .6em;
|
||||
padding-top: .6em;
|
||||
padding-right: .6em;
|
||||
padding-bottom: .6em;
|
||||
padding-left: 0.6em;
|
||||
padding-top: 0.6em;
|
||||
padding-right: 0.6em;
|
||||
padding-bottom: 0.6em;
|
||||
margin-left: 1.4em;
|
||||
margin-right: .4em;
|
||||
margin-right: 0.4em;
|
||||
border-radius: 4px;
|
||||
font-family: "Microsoft YaHei";
|
||||
background: url(http://test.forge.trustie.net/images/requirements/xreference.jpg.pagespeed.ic.h4inUJNyH0.jpg);
|
||||
/*background: url('../images/requirements/reference.jpg');*/
|
||||
background-size: 100% 100%;
|
||||
margin-top:5px;
|
||||
}
|
||||
/*上传项目图片*/
|
||||
.upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}
|
||||
|
|
Loading…
Reference in New Issue