Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-06-04 17:46:32 +08:00
commit de3536fd68
25 changed files with 761 additions and 447 deletions

View File

@ -0,0 +1,54 @@
class ActivityNotifysController < ApplicationController
# layout 'base_projects'#by young
# default_search_scope :messages
before_filter :find_project_by_project_id#, :find_board_if_available
# before_filter :authorize, :except => [:new, :show, :create, :index]
# accept_rss_auth :index, :show
helper :activities
def index
query = nil
if @course
query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',@course.id,'Course',User.current.id);
else
@events_by_day = []
end
if( query != nil )
logger.info('xxoo')
limit = 10;
@obj_count = query.count();
@obj_pages = Paginator.new @obj_count,limit,params['page']
list = query.order('id desc').limit(limit).offset(@obj_pages.offset).all();
events=[];
for item in list
event = item.activity;
event.set_notify_id(item.id)
event.set_notify_is_read(item.is_read)
events << event
end
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
@controller_name = 'ActivityNotifys'
logger.info('aavv')
end
respond_to do |format|
format.html {render :template => 'courses/show', :layout => 'base_courses'}
end
end
def chang_read_flag
if @course
if(params[:an_id] != nil )
query = ActivityNotify.where('id=? and notify_to=?',params[:an_id],User.current.id)
else
query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=? and is_read=0',@course.id,'Course',User.current.id)
end
@result = query.update_all('is_read=1');
else
@result = false;
end
respond_to do |format|
format.html{render :layout => nil}
end
end
end

View File

@ -88,14 +88,40 @@ class BoardsController < ApplicationController
preload(:author, {:last_reply => :author}).
all
elsif @course
board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
includes(:last_reply).
# limit(@topic_pages.per_page).
# offset(@topic_pages.offset).
preload(:author, {:last_reply => :author}).
all : []
@topics = paginateHelper board_topics,10
#
# board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
# includes(:last_reply).
# # limit(@topic_pages.per_page).
# # offset(@topic_pages.offset).
#
# preload(:author, {:last_reply => :author}).
# all : []
# @topics = paginateHelper board_topics,10
if( @board )
limit = 10;
pageno = params[:page];
if(pageno == nil || pageno=='')
dw_topic = nil;
if( params[:parent_id]!=nil && params[:parent_id]!='' )
dw_topic = @board.topics.where(id:params[:parent_id]).first();
end
if( dw_topic != nil )
dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count();
dw_count = dw_count+1;
pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1)
end
end
if(pageno == nil || pageno=='')
pageno=1;
end
@topic_count = @board.topics.count();
@topic_pages = Paginator.new @topic_count, limit, pageno
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
limit(limit).offset(@topic_pages.offset).includes(:last_reply).
preload(:author, {:last_reply => :author}).all();
else
@topics = [];
end
end
@message = Message.new(:board => @board)
@ -103,6 +129,7 @@ class BoardsController < ApplicationController
if @project
render :action => 'show', :layout => 'base_projects'
elsif @course
@params=params
render :action => 'show', :layout => 'base_courses'
end
}

View File

@ -200,7 +200,7 @@ class HomeworkCommonController < ApplicationController
end
#是不是课程的老师
def teacher_of_course
render_403 unless User.current.allowed_to?(:as_teacher,@course)
render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
end
def get_assigned_homeworks(student_works, n, index)

View File

@ -31,6 +31,8 @@ class MessagesController < ApplicationController
include AttachmentsHelper
helper :project_score
include CoursesHelper
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
# Show a topic and its replies
@ -91,6 +93,29 @@ class MessagesController < ApplicationController
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end
# 与我相关动态的记录add start
if(@board.course_id>0) #项目的先不管
teachers = searchTeacherAndAssistant(@board.course);
for teacher in teachers
if(teacher.user_id != User.current.id)
notify = ActivityNotify.new()
if(@board.course_id>0)
notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course'
else
notify.activity_container_id = @board.project_id
notify.activity_container_type = 'Project'
end
notify.activity_id = @message.id
notify.activity_type = 'Message'
notify.notify_to = teacher.user_id
notify.is_read = 0
notify.save()
end
end
end
# 与我相关动态的记录add end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
if params[:is_board]
@ -151,6 +176,35 @@ class MessagesController < ApplicationController
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
end
# 与我相关动态的记录add start
if(@board.course_id>0) #项目的先不管
notifyto_arr = {}
notifyto_arr[@topic.author_id] = @topic.author_id
if( params[:parent_topic] != nil && params[:parent_topic] != '')
parent_topic = Message.find(params[:parent_topic])
notifyto_arr[parent_topic.author_id] = parent_topic.author_id
end
notifyto_arr.each do |k,user_id|
if(user_id != User.current.id)
notify = ActivityNotify.new()
if(@board.course_id>0)
notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course'
else
notify.activity_container_id = @board.project_id
notify.activity_container_type = 'Project'
end
notify.activity_id = @reply.id
notify.activity_type = 'Message'
notify.notify_to = user_id
notify.is_read = 0
notify.save()
end
end
end
# 与我相关动态的记录add end
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply)

View File

@ -364,6 +364,7 @@ class ProjectsController < ApplicationController
#发送邮件邀请新用户
def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all
@is_zhuce = false
respond_to do |format|
format.html

View File

@ -253,13 +253,13 @@ class StudentWorkController < ApplicationController
#是不是当前课程的成员
#当前课程成员才可以看到作品列表
def member_of_course
render_403 unless User.current.member_of_course? @course
render_403 unless User.current.member_of_course? @course || User.current.admin?
end
#判断是不是当前作品的提交者
#提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品
def author_of_work
render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
#根据条件过滤作业结果

View File

@ -0,0 +1,3 @@
class ActivityNotify < ActiveRecord::Base
belongs_to :activity, polymorphic: true
end

View File

@ -1,5 +1,13 @@
class InviteList < ActiveRecord::Base
attr_accessible :project_id, :user_id
# belongs_to :user
# belongs_to :project
belongs_to :user
belongs_to :project
# 用户拒绝邀请后,删除记录
def self.delete_inviter(userid, projectid)
@inviters = AppliedProject.where("user_id = ? and project_id = ?", userid, projectid)
@inviters.each do |inviter|
inviter.destroy
end
end
end

View File

@ -58,6 +58,7 @@ class Mailer < ActionMailer::Base
us = UsersService.new
# 自动激活用户
user = us.register_auto(login, @email, @password)
InviteList.create(:user_id => user.id, :project_id => project.id)
User.current = user unless User.current.nil?
@user = user
@ -73,6 +74,10 @@ class Mailer < ActionMailer::Base
@project_name = "#{project.name}"
@user = user
@project = project
inviter_lists = InviteList.where(project_id:@project.id, user_id:@user.id).all
if inviter_lists.blank?
InviteList.create(:user_id => user.id, :project_id => project.id)
end
@token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
mail :to => email, :subject => @subject
@ -83,13 +88,10 @@ class Mailer < ActionMailer::Base
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
def send_for_user_activities(user, date_to, days)
date_from = date_to - days.days
subject = "[ #{user.show_name}#{l(:label_day_mail)}]"
@subject = " #{user.show_name}#{l(:label_day_mail)}"
date_from = "#{date_from} 17:59:59"
date_to = "#{date_to} 17:59:59"
# 生成token用于直接点击登录
@user = user
@token = Token.get_token_from_user(user, 'autologin')
@ -100,19 +102,15 @@ class Mailer < ActionMailer::Base
project_ids = projects.map{|project| project.id}.join(",")
course_ids = courses.map {|course| course.id}.join(",")
# 查询user的缺陷包括发布的跟踪的以及被指派的缺陷
sql = "select DISTINCT i.* from issues i, watchers w
where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
# 查询user的缺陷项目中成员都能收到
sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
@issues = Issue.find_by_sql(sql)
# @bids 查询课程作业包括老师发布的作业以及user提交作业
# @attachments查询课程课件更新
@attachments ||= []
@bids ||= [] # 老师发布的作业
unless courses.first.nil?
count = courses.count
count = count - 1
@ -127,7 +125,9 @@ class Mailer < ActionMailer::Base
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子
messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where
b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
# messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@course_messages ||= []
@project_messages ||= []
unless messages.first.nil?
@ -139,6 +139,7 @@ class Mailer < ActionMailer::Base
end
end
end
# 查询user在课程中发布的通知项目中发的新闻
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
where n.course_id in (#{course_ids})
@ -151,18 +152,13 @@ class Mailer < ActionMailer::Base
jour_type='Course' and user_id = #{user.id}
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
# 查询user新建贴吧或发布帖子
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news,
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o|
!o.empty?
}
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发
mail :to => user.mail,:subject => subject if has_content

View File

@ -34,6 +34,8 @@ class Message < ActiveRecord::Base
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# end
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
acts_as_searchable :columns => ['subject', 'content'],
:include => {:board => :project},
:project_key => "#{Board.table_name}.project_id",
@ -148,6 +150,19 @@ class Message < ActiveRecord::Base
usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project)))
end
def set_notify_id(notify_id)
@notify_id= notify_id
end
def get_notify_id()
return @notify_id
end
def set_notify_is_read(notify_is_read)
@notify_is_read = notify_is_read
end
def get_notify_is_read()
return @notify_is_read
end
private
def add_author_as_watcher
@ -218,4 +233,5 @@ class Message < ActiveRecord::Base
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
end
end

View File

@ -67,7 +67,7 @@ class Project < ActiveRecord::Base
has_many :student, :through => :students_for_courses, :source => :user
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
has_many :applied_projects
# has_many :invite_lists
has_many :invite_lists
# end
#ADDED BY NIE

View File

@ -0,0 +1 @@
<%= @result == false ? 'false' : 'true' %>

View File

@ -109,6 +109,7 @@
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<input name="parent_topic" type="hidden" value=""/>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<div style="padding-top:5px;" class="fr">
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
@ -127,7 +128,7 @@
<ul>
<% replies_all.each do |message| %>
<% replies_all_i=replies_all_i+1 %>
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>" id="topic<%=message.id%>">
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
@ -151,6 +152,7 @@
:nhname =>'showbtn_child_reply',
:class => ' c_dblue fr',
:style => 'margin-right: 10px;',
'data-topic-id' =>message.id,
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div>
<div class="cl"></div>
@ -172,7 +174,8 @@
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>
<%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
@ -255,6 +258,18 @@
}
nh_init_board(params);
});
<% if( @params[:topic_id]!=nil && @params[:topic_id]!='' && @params[:page]==nil ) %>
var nh_dw_html = $("#topic<%=@params[:topic_id]%>");
if(nh_dw_html!=undefined && nh_dw_html.length!=0){
if(nh_dw_html.is(':hidden')){
$("a[nhname='reply_ex_btn']",nh_dw_html.parent('ul').parent('div').parent('div')).click();
}
$("#nhjump").attr('href','#'+nh_dw_html.attr('id'));
$("#nhjump")[0].click();
}
<% end %>
<% if(!@flag.nil? && @flag=='true') %>
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
<% end %>

View File

@ -1,11 +1,11 @@
<style>
.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ke-toolbar-icon-url{background-image:url( '/images/public_icon.png' )}
.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ke-toolbar .ke-outline{border:none;}
<style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
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;}
.break_word {width:100%;}
</style>
<script type="text/javascript">
@ -13,7 +13,9 @@
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
var div = document.getElementById(menuids[i]);
if(div == undefined)continue;
var ultags=div.getElementsByTagName("ul")
for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
ultags[t].parentNode.onmouseover=function(){
@ -201,6 +203,8 @@ function nh_init_board(params){
params.cancelbtn.click();
}
}
var parent_topic_id = $(this).data('topic-id');
if(parent_topic_id!=undefined)$("input[name='parent_topic']",params.form).val(parent_topic_id);
var ref_str = params.get_ref_str_call($(this));
params.quote_show.html(ref_str);
params.quote_input.html(ref_str);

View File

@ -1,11 +1,22 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_activity)%></h2>
<% if @controller_name=='ActivityNotifys' %>
<a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2">与我相关</h2>
<div class="fr mt10 mr5 c_grey02">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</div>
<% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
<% if User.current.logged? %>
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关</a>
<% end %>
<% end %>
</div>
<% if @events_by_day != nil && @events_by_day.size >0 %>
<% @events_by_day.keys.sort.reverse.each do |day| %>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="problem_main">
<div class="problem_main" nhname="container">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
</a>
@ -14,8 +25,19 @@
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
<span class="fl"> &nbsp;</span>
<span class="fl"> <%= l(:label_new_activity) %></span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") || e.event_type.eql?("reply") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>
<%
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) :
(e.event_type.eql?("message") || e.event_type.eql?("reply") ?
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url))
%>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%if @controller_name=='ActivityNotifys' && !e.get_notify_is_read%>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
<%end%>
<br />
<p class="mt5 break_word"><%= e.event_description.html_safe %>
<br />
@ -28,7 +50,7 @@
<% end%>
<% end%>
<% end%>
<% if @obj_pages.next_page.nil? %>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
@ -51,3 +73,35 @@
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<script type="text/javascript">
$(function(){
$("div[nhname='container']").each(function(){
var container = $(this);
var btn = $("a[nhname='nh_act_link']",container);
if(btn.data('notify-id')>0){
btn.attr('target','_blank');
btn.click(function(){
var flag = $("span[nhname='nh_act_flag']",container);
if(flag!=undefined){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
flag.remove();
}
}});
}
return true;
});
}
});
$("label[nhname='nh_act_link_all']").click(function(){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
$("span[nhname='nh_act_flag']").remove();
}
}});
});
});
</script>

View File

@ -1,9 +1,6 @@
<p>
<span class="c_blue" style="color:#1b55a7;">
<%= link_to(h("#{@news.author.login}(#{@news.author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %>
</span><%= l(:mail_issue_title_userin)%>
<span class="c_blue" style="color:#1b55a7;">
<% if @news.project %>
@ -11,7 +8,8 @@
<% elsif @news.course %>
<%=h @news.course.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %>
<% end %>
</span><%= l(:mail_issue_title_active)%></p>
</span><%= l(:mail_issue_title_active)%>
</p>
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
<ul style="list-style-type:none; margin:0; padding:0;">
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_subject)%></strong></span>
@ -25,7 +23,7 @@
</li>
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<%= @news.description %>
<%= @news.description.html_safe %>
</span>
</li>

View File

@ -1,10 +1,3 @@
<div class="content">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= @subject %>
@ -15,12 +8,10 @@
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
<% unless @course_news.first.nil? %>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_news) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_news.count %>)</span>
</h4>
<% @course_news.each do |course_new|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
@ -44,11 +35,12 @@
<% end %>
<div class="cl"></div>
</ul><!--课程动态 end-->
</ul><!--课程通知 end-->
<% end %>
<!--课程作业-->
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
@ -101,9 +93,9 @@
</ul><!--作业动态 end-->
<% end %>
<!-- 课程留言 -->
<% unless @course_journal_messages.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:view_course_journals_for_messages) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
@ -130,45 +122,39 @@
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课程留言 end-->
<% end %>
<!-- 课程讨论区 -->
<% unless @course_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:view_borad_course) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
</h4>
<% @course_messages.each do |course_message|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课程讨论 end-->
</ul><!-- 课程讨论区end -->
<% end %>
<!-- 课件 -->
<% unless @attachments.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
@ -200,8 +186,12 @@
<div class="cl"></div>
</ul><!--课件下载 end-->
<% end %>
</div><!--课程动态 end-->
</div>
<% end %>
<!--项目相关-->
<% if @issues.first || @project_messages.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
@ -211,21 +201,17 @@
<%= l(:label_issue_tracking) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @issues.count %>)</span>
</h4>
<% @issues.each do |issue|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_issue) %></span>
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
@ -238,6 +224,7 @@
</ul><!--问题跟踪 end-->
<% end %>
<!-- 讨论区 -->
<% unless @project_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
@ -271,10 +258,41 @@
</ul><!--项目论坛 end-->
<% end %>
<!--项目新闻-->
<% unless @project_news.first.nil? %>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_news) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_news.count %>)</span>
</h4>
<% @project_news.each do |project_new|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span>
</div><!--项目动态 end-->
<%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_new.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!-- 项目新闻end -->
<% end %>
</div>
<% end %><!-- 项目动态end -->
<!-- 用户留言 -->
<% unless @user_journal_messages.first.nil? %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
@ -303,7 +321,7 @@
<% end %>
<div class="cl"></div>
</ul><!--课程动态 end-->
</ul><!--用户留言 end-->
</div><!--个人动态 end-->
<% end %>

View File

@ -76,8 +76,24 @@
<a href="#" class="btn_free" onclick="senderEmail($(this));">
<%= l(:label_send_email)%>
</a>
<% end %>
<%# 邀请用户的状态 %>
<% unless @inviter_lists.blank? %>
<div>
<span class="status_inviter">已邀请的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<%= inviter_list.user.name %><br/>
<% end %>
</br>
<span class="status_inviter">等待加入项目的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<% unless inviter_list.user.member_of?(@project) %>
<%= inviter_list.user.name %><br/>
<% end %>
<% end %>
</div>
<% end %>
</div>
</div>

View File

@ -86,6 +86,7 @@ zh:
label_roadmap: 里程碑 #版本路线图
project_module_dts: DTS测试工具
label_project_tool_response: 用户反馈
label_course_news: 项目新闻
label_project_overview: "项目简介"
label_expend_information: 展开更多信息

View File

@ -710,6 +710,12 @@ RedmineApp::Application.routes.draw do
resources :news, :except => [:show, :edit, :update, :destroy]
resources :boards
match '/homework', :to => 'courses#homework', :as => 'homework', :via => :get
resources :activity_notifys do
collection do
match 'chang_read_flag', :via => :get
end
end
end # end of resources :courses
match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback'
match '/courses/search', :via => [:get, :post]

View File

@ -0,0 +1,17 @@
class CreateActivityNotifies < ActiveRecord::Migration
def change
create_table :activity_notifies do |t|
t.integer :activity_container_id
t.string :activity_container_type
t.integer :activity_id
t.string :activity_type
t.integer :notify_to
t.datetime :created_on
t.integer :is_read
end
add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to"
add_index "activity_notifies", ["created_on"], :name => "index_an_created_on"
add_index "activity_notifies", ["activity_container_id","activity_container_type"], :name => "index_an_activity_container_id"
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150602055730) do
ActiveRecord::Schema.define(:version => 20150604153000) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -23,6 +23,20 @@ ActiveRecord::Schema.define(:version => 20150602055730) do
add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
create_table "activity_notifies", :force => true do |t|
t.integer "activity_container_id"
t.string "activity_container_type"
t.integer "activity_id"
t.string "activity_type"
t.integer "notify_to"
t.datetime "created_on"
t.integer "is_read"
end
add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id"
add_index "activity_notifies", ["created_on"], :name => "index_an_created_on"
add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to"
create_table "api_keys", :force => true do |t|
t.string "access_token"
t.datetime "expires_at"
@ -606,6 +620,13 @@ ActiveRecord::Schema.define(:version => 20150602055730) do
t.datetime "updated_at", :null => false
end
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "issue_categories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :limit => 30, :default => "", :null => false

BIN
public/images/new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -53,9 +53,9 @@ a:hover.problem_new_btn{ background:#ff7143; color:#fff;}
a.problem_pic{ display:block; width:42px; height:42px; padding:3px; border:1px solid #e3e3e3;}
a:hover.problem_pic{border:1px solid #64bdd9;}
.problem_txt{ width:610px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;}
a.problem_name{ color:#ff5722;}
a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
a:hover.problem_name{ color:#d33503;}
a.problem_tit{ color:#0781b4; max-width:430px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a:hover.problem_tit{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
/****翻页***/
@ -677,7 +677,10 @@ input#score{ width:40px;}
.evaluation_submit{position: absolute;right: 0px;bottom: 5px;}
.student_work_search{background-color: #64bdd9;color: white !important;padding: 2px 7px;margin-left: 10px;cursor: pointer; }
/* 与我相关 */
.new_icon{background:url(../images/new_icon.png) 0px 0px no-repeat; width:35px; height:15px; display:block;}
a.about_me{ width:80px;text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;}
a:hover.about_me{ color:#0781b4;}

View File

@ -49,6 +49,7 @@ a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repea
a:hover.icon_removem{background:url(../images/img_floatbox.png) -22px -61px no-repeat;}
a.btn_free{ background:#ff5722; display:block; text-align:center; color:#fff; padding:3px 0; width:80px; margin-bottom:10px;}
a:hover.btn_free{ background:#d63502;}
.status_inviter{color: #3CA5C6;font-weight: bold; font-size: 14px }
/*成员邀请*/
.invi_search{ }
.invi_search_input{ border:1px solid #15bccf; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:10px;}