Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2016-10-28 14:20:12 +08:00
commit b0b5e203b3
6 changed files with 57 additions and 83 deletions

View File

@ -228,18 +228,18 @@ class NewsController < ApplicationController
@news.safe_attributes = params[:news]
@news.save_attachments(params[:attachments])
if @news.save
@course.members.each do |m|
if m.user_id != User.current.id
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{@news.course_id}").count
if count == 0
ws = WechatService.new
content = @news.title
name = @news.course.syllabus.nil? ? @news.course.name : @news.course.syllabus.title+""+@news.course.name
ws.class_notice m.user_id, "course_notice", @news.id, "#{l(:label_new_notice_template)}", name, @news.author.show_name, format_time(@news.created_on), content, "点击查看通知详情"
end
end
end
# @course.members.each do |m|
# if m.user_id != User.current.id
# #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{@news.course_id}").count
# if count == 0
# ws = WechatService.new
# content = @news.title
# name = @news.course.syllabus.nil? ? @news.course.name : @news.course.syllabus.title+" • "+@news.course.name
# ws.class_notice m.user_id, "course_notice", @news.id, "#{l(:label_new_notice_template)}", name, @news.author.show_name, format_time(@news.created_on), content, "点击查看通知详情"
# end
# end
# end
if params[:asset_id]
ids = params[:asset_id].split(',')

View File

@ -8,14 +8,17 @@ module AvatarHelper
FileUtils.cp(src_file, des_file) if File.exist?(src_file)
end
def avatar_image(source, copyed=false)
source_type = source.class
source_id = source.id
course = Course.find(source_id) rescue nil
if course && copyed
source_id = course.is_copy
# course = Course.find(source_id) rescue nil
# if course && copyed
# source_id = course.is_copy
# end
if source_type.to_s == 'Course' && copyed
source_id = source.is_copy
end
File.join(relative_path, avatar_directory(source_type), source_id.to_s)

View File

@ -65,7 +65,7 @@ class News < ActiveRecord::Base
:author_key => :author_id
acts_as_watchable
after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :delay_news_send
after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message,:delay_news_wechat_send,:delay_news_send
after_update :update_activity
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
@ -186,6 +186,26 @@ class News < ActiveRecord::Base
end
end
def delay_news_wechat_send
if self.course
self.delay.news_wechat_message
end
end
def news_wechat_message
self.course.members.each do |m|
if m.user_id != self.author_id
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
content = self.title
ws.class_notice m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.course.name, self.author.show_name, format_time(self.created_on), content, "点击查看通知详情"
end
end
end
end
def delay_news_send
if self.course
self.delay.contain_news_message

View File

@ -1,5 +1,6 @@
<div class="conbox">
<h2 class="conbox-h2">查重结果</h2>
<h2 class="conbox-h2" style="border-bottom:1px solid #ddd;">查重结果</h2>
<p class="nodata mt10 ml10 mr10" style="text-align: left;">代码量少的作品,误报率高,因此不参与查重</p>
<div class="chabox">
<ul class="chabox-header">
<li class="chabox-w-500" style = "width:437px" >被查作品</li>

View File

@ -14,7 +14,7 @@
<div id="users_tb_" class="users_tb_">
<ul>
<li id="users_tb_1" class="users_hovertab" onclick="x:HoverLi(1);">基本资料</li>
<li id="users_tb_2" class="users_normaltab" onclick="i:HoverLi(2);">账号管理</li>
<li id="users_tb_2" class="users_normaltab" onclick="i:HoverLi(2);">密码管理</li>
</ul>
</div><!--tb_ end-->
<div class="cl"></div>
@ -29,10 +29,10 @@
<li><span style="color:red;">*</span>&nbsp;&nbsp;登录名&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;邮箱&nbsp;:&nbsp;</li>
<li><span style="color:red;">*</span>&nbsp;&nbsp;职业&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><span style="color:red;">*</span>&nbsp;&nbsp;姓名&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;姓名&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><span style="color:red;">*</span>&nbsp;&nbsp;性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;" ><span style="color:red;">*</span>&nbsp;&nbsp;单位名称&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><span style="color:red;">*</span>&nbsp;&nbsp;单位名称&nbsp;:&nbsp;</li>
<li>地区&nbsp;:&nbsp;</li>
<li>邮件通知&nbsp;:&nbsp;</li>
<!--<li>个人签名&nbsp;:&nbsp;</li>-->
@ -62,13 +62,13 @@
<%= l(:label_account_identity_developer) %>
</option>
</select>
<select nhname="tag" nh_tag_0="true" name="technical_title" id="userTechnical_title" class="w70" style='display:none;height:28px;'>
<select nhname="tag_1" nh_tag_0="true" name="technical_title" id="userTechnical_title" class="w70" style='display:none;height:28px;'>
<option value="教授">教授</option>
<option value="副教授">副教授</option>
<option value="讲师">讲师</option>
<option value="助教">助教</option>
</select>
<span nhname="tag" nh_tag_1="true" style='display:none;'>
<span nhname="tag_1" nh_tag_1="true" style='display:none;'>
<% if !User.current.user_extensions.nil? && !User.current.user_extensions.student_id.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID),:style => "width:127px;" %>
<% else %>
@ -78,9 +78,9 @@
<span id="identity_hint" style="display: none"></span>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= text_field_tag :lastname, @user.lastname+@user.firstname, :no_label => true, :required => true, :nh_required => "1",:class => "w210" %><span id="last_name_notice" class="none c_red">姓名不能为空</span>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" ><%= text_field_tag :lastname, @user.lastname+@user.firstname, :no_label => true, :required => true, :nh_required => "1",:class => "w210" %><span id="last_name_notice" class="none c_red">姓名不能为空</span>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" >
<% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
<input type="radio" id="sex" value="0" name="sex" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" checked="checked" class="fl "><label class="fl ">女</label>
<% else %>
@ -89,10 +89,10 @@
<select style = "display: none;" class="w70" style="height:28px;margin-left:2px;" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" >
<!-- 基本资料页面单位审核显示 -->
<% if User.current.user_extensions.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" placeholder=" --请选择您所属的单位--"/>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
@ -102,10 +102,10 @@
<!-- 从业者选择单位名称 -->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
<% if User.current.user_extensions.school_id.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text"value="<%= User.current.user_extensions.school %>" >
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text"value="<%= User.current.user_extensions.school %>" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.school.id %>" /> <!-- 单位名称的test框选中下拉列表框的id -->
<% end %>
<p class="fl ml10">
@ -114,7 +114,7 @@
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.school.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" placeholder=" --请选择您所属的单位--" />
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
@ -187,7 +187,7 @@
<%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %>
<% end %>
<% else %>
<p class="nodata" style="height: 22px; font-size: 14px; text-align: left; line-height: 20px;">您还没有创建属于自己的个人主页。<%=link_to '新建', new_user_homepage_article_homepage_path(:user_id=> @user.id, :homepage_id => @user.homepage.id), :target => "_blank", :class => 'linkBlue' %></p>
<p class="nodata" style="height: 22px; font-size: 14px; text-align: left; line-height: 20px;">您还没有创建属于自己的个人主页。<%=link_to '新建', new_user_homepage_article_homepage_path(:user_id=> @user.id, :homepage_id => @user.homepage.id),:onclick=>"my_account_form_submit();", :target => "_blank", :class => 'linkBlue' %></p>
<% end %>
<!--<textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea>-->
</li>
@ -280,7 +280,7 @@
<script type="text/javascript">
function showtechnical_title(val){
$("*[nhname='tag']").each(function(){
$("*[nhname='tag_1']").each(function(){
$("*[nh_required='1']",$(this)).attr("required",false);
$(this).hide()
});

View File

@ -1,50 +0,0 @@
<div class="userCard boxShadow" style="<%= User.current == user ? 'top:-153px;':'' %>">
<div class="userAvatarWrap fl">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像", :target => '_blank' %>
<%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
<!--<img src="images/homepageImage.jpg" width="50" height="50" alt="个人头像" />-->
</div>
<div class="fl">
<p class="homepageImageName mb5 hidden" style="max-width:88px;font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:21px; float:left;"><%= user %></p>
<% if (user.user_extensions && (user.user_extensions.identity != 2) ) %>
<span class="<%= user.user_extensions.gender == 1 ? 'homepageImageSexWomen' : 'homepageImageSexMan' %> "></span>
<% end %>
<!--<span class="homepageImageSex"></span>-->
<div class="cl"></div>
<p class="mb8 c_dark f14">
<span class="mr15 hidden fl ml15" style="max-width:90px;"><%= user.show_name %></span>
<% if user.user_extensions && user.user_extensions.identity %>
<%= get_user_roll(user) %>
<% end %>
</p>
</div>
<div class="cl"></div>
<div>
<div class="homepageImageBlock mb10">
<div><%= link_to User.watched_by(user.id).count, user_watchlist_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %></div>
<div class="homepageImageText"><%= link_to '关注',user_watchlist_url_in_org(user.id),:target => "_blank" %></div>
</div>
<div class="homepageVerDiv"></div>
<div class="homepageImageBlock">
<div><%= link_to user.watcher_users.count,user_fanslist_url_in_org(user.id), :class => "homepageImageNumber fans_count_#{user.id}",:target => "_blank" %></div>
<div class="homepageImageText"><%= link_to '粉丝', user_fanslist_url_in_org(user.id),:target => "_blank" %></div>
</div>
<div class="homepageVerDiv"></div>
<div class="homepageImageBlock">
<div><%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %></div>
<div class="homepageImageText"><%= link_to '博客', user_blogs_url_in_org(user.id),:target => "_blank" %></div>
</div>
<div class="cl"></div>
<% if User.current != user %>
<div class="add_cancel_watch_<%= user.id %>">
<%= render :partial => 'users/watch_btn_for_picture', :locals => {:user => user} %>
</div>
<!--<a href="javascript:void(0);" class="userFollow mr27 fl">添加关注</a> <a href="javascript:void(0);" class="userCancel mr27 fl" style="display:none;">取消关注</a>-->
<%= link_to "留言", feedback_url_in_org(user.id), :class => 'greyBtn fr', :target => "_blank" %>
<%= link_to "私信", feedback_url_in_org(user.id), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %>
<!--<a href="javascript:void(0);" class="greyBtn fl">私信</a><a href="javascript:void(0);" class="greyBtn fr">留言</a> -->
<% end %>
</div>
<em></em>
<font></font>
</div>