Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
e61822d74a
|
@ -894,7 +894,6 @@ class ApplicationController < ActionController::Base
|
|||
set_autologin_cookie(user)
|
||||
end
|
||||
call_hook(:controller_account_success_authentication_after, {:user => user })
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ class MyController < ApplicationController
|
|||
# edit
|
||||
before_filter :auth_login1, :only => [:account]
|
||||
#
|
||||
before_filter :require_login
|
||||
before_filter :require_login, except: [:change_mail_notification]
|
||||
|
||||
helper :issues
|
||||
helper :users
|
||||
|
@ -75,6 +75,19 @@ class MyController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def change_mail_notification
|
||||
token = params[:token]
|
||||
user = try_to_autologin1
|
||||
if user
|
||||
user.mail_notification = params[:mail_notification]
|
||||
user.save
|
||||
flash[:notice] = l(:notice_mail_notification_updated)
|
||||
redirect_to my_account_url
|
||||
else
|
||||
redirect_to signin_url
|
||||
end
|
||||
end
|
||||
|
||||
# Edit user's account
|
||||
def account
|
||||
@user = User.current
|
||||
|
|
|
@ -57,5 +57,98 @@ class TestController < ApplicationController
|
|||
attach.filename
|
||||
end
|
||||
|
||||
def mailer()
|
||||
raise unless Rails.env.development?
|
||||
@user = User.find(params[:user_id])
|
||||
send_for_user_activities(@user, Time.now,1)
|
||||
render 'mailer/send_for_user_activities'
|
||||
end
|
||||
def send_for_user_activities(user, date_to, days)
|
||||
date_from = date_to - days.days
|
||||
|
||||
end
|
||||
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.new(:user =>user , :action => 'autologin')
|
||||
token.save
|
||||
@token = token
|
||||
|
||||
# 查询user参加的项目及课程
|
||||
projects = user.projects
|
||||
courses = user.courses
|
||||
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}))
|
||||
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
|
||||
for i in 0..count do
|
||||
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
|
||||
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
|
||||
@bids += bids if bids.count > 0
|
||||
@attachments += attachments if attachments.count > 0
|
||||
end
|
||||
end
|
||||
# user 提交的作业
|
||||
@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")
|
||||
@course_messages ||= []
|
||||
@project_messages ||= []
|
||||
unless messages.first.nil?
|
||||
messages.each do |msg|
|
||||
if msg.project
|
||||
@project_messages << msg
|
||||
elsif msg.course
|
||||
@course_messages << msg
|
||||
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})
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
|
||||
@project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
|
||||
|
||||
# 查询user在课程及个人中留言
|
||||
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where
|
||||
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?
|
||||
}
|
||||
#有内容才发,没有不发
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -64,19 +64,16 @@ 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} : #{date_to} #{l(:label_day_mail)}"
|
||||
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.new(:user =>user , :action => 'autologin')
|
||||
token.save
|
||||
@token = token
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
|
||||
@user_url = url_for(my_account_url(user,:token => @token.value))
|
||||
# 查询user参加的项目及课程
|
||||
projects = user.projects
|
||||
courses = user.courses
|
||||
|
@ -256,10 +253,9 @@ class Mailer < ActionMailer::Base
|
|||
@author = issue.author
|
||||
@issue = issue
|
||||
user = User.find_by_mail(recipients)
|
||||
token = Token.new(:user =>user , :action => 'autologin')
|
||||
token.save
|
||||
@token = token
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value)
|
||||
@user = user
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value)
|
||||
|
||||
# edit
|
||||
@issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
|
||||
|
@ -299,10 +295,8 @@ class Mailer < ActionMailer::Base
|
|||
@author = journal.user
|
||||
|
||||
user = User.find_by_mail(recipients)
|
||||
|
||||
token = Token.new(:user =>user , :action => 'autologin')
|
||||
token.save
|
||||
@token = token
|
||||
@user = user
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
|
||||
|
||||
# edit
|
||||
|
|
|
@ -27,6 +27,14 @@ class Token < ActiveRecord::Base
|
|||
self.value = Token.generate_token_value
|
||||
end
|
||||
|
||||
def self.get_token_from_user(user, action)
|
||||
token = Token.where(:action => action, :user_id => user).first
|
||||
unless token
|
||||
token = Token.create(user: user, action: action)
|
||||
end
|
||||
token
|
||||
end
|
||||
|
||||
# Return true if token has expired
|
||||
def expired?
|
||||
return Time.now > self.created_on + @@validity_time
|
||||
|
|
|
@ -16,6 +16,13 @@
|
|||
});
|
||||
}
|
||||
|
||||
function EnterPress(e){
|
||||
var e = e || window.event;
|
||||
if(e.keyCode == 13){
|
||||
remote_function();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -24,10 +31,10 @@
|
|||
</div>
|
||||
<div class="problem_top">
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
|
||||
<%#= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
|
||||
<%= hidden_field_tag 'set_filter', '1' %>
|
||||
<div class="problem_search" >
|
||||
<input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="">
|
||||
<input class="problem_search_input fl" id="v_subject" type="text" name="v[subject]" value="" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
|
||||
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
|
||||
</div><!--problem_search end-->
|
||||
|
||||
|
@ -58,7 +65,7 @@
|
|||
%>
|
||||
</div><!--filter_form end-->
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
<p class="problem_p fl" ><%= l(:label_issues_sum) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.count %></a>
|
||||
<%= l(:lable_issues_undo) %>:<a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').count %> </a>
|
||||
</p>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!--add by huang-->
|
||||
<div class="clearfix"></div>
|
||||
<div id="footer" style="margin-left:-5px;padding-top: 20px;clear: both;font-size: 12px;">
|
||||
<div id="footer" style="padding-top: 20px;clear: both;font-size: 12px;">
|
||||
<div style="border-top:solid 1px #C6E9F1;"></div>
|
||||
<div class="base_footer">
|
||||
<div align="center">
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
</script>
|
||||
</head>
|
||||
|
||||
<body style=" height:1500px;">
|
||||
<body>
|
||||
<div id="update_info"></div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
<div class="mail_content" style="margin-top:30px; margin:0; padding:0; border:0;">
|
||||
|
||||
|
||||
<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="mail_foot" style="margin:0; padding:0; border:0;"><%= link_to( l(:mail_issue_footer), @user_url , :style=>'font-size:12px; font-weight:normal; color:#1b55a7;') %> </div>
|
||||
<div class="mail_foot" style="margin:0; padding:0; border:0;">
|
||||
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
|
||||
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
|
||||
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
|
||||
<% else %>
|
||||
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,5 +3,14 @@
|
|||
|
||||
|
||||
<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %>
|
||||
<div class="mail_foot"><%= link_to( l(:mail_issue_footer), @user_url, :style=>'font-size:12px; font-weight:normal; color:#1b55a7;') %> </div>
|
||||
|
||||
<div class="mail_foot" style="margin:0; padding:0; border:0;">
|
||||
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
|
||||
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
|
||||
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
|
||||
<% else %>
|
||||
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="content">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= @subject %>
|
||||
|
@ -365,9 +367,13 @@
|
|||
</div><!--贴吧动态 end-->
|
||||
<% end %>
|
||||
<div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;">
|
||||
<%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
||||
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
|
||||
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
|
||||
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
|
||||
<% else %>
|
||||
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -43,12 +43,13 @@
|
|||
<%= f.kindeditor :content, :required => true, :size => 80,:owner_id => @memo.id,:owner_type => 1 %>
|
||||
</p>
|
||||
<!-- <script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
|
||||
<p>
|
||||
<p style="float: left;margin-top: 5px;">
|
||||
<%= l(:label_attachment_plural) %>
|
||||
<br />
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
|
||||
</p>
|
||||
<br/>
|
||||
<div class="cl"></div>
|
||||
<%= f.submit :value => l(:button_change) %> <%= link_to l(:button_back), back_url ,:class => "button-canel",:style => "color: #ffffff;"%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -3,12 +3,23 @@
|
|||
<%= l(:label_board) %>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="topbar_info02 fl">
|
||||
<p class="hiddent">
|
||||
<%= l(:label_user_location) %> :
|
||||
<%= link_to l(:label_borad_course), course_boards_path(@course) %>
|
||||
>
|
||||
<%= link_to @topic.subject, course_board_path(@course, @board) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="problem_main">
|
||||
<div class="ping_dispic">
|
||||
<%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="talk_txt fl">
|
||||
<p class="problem_tit fl fb c_blue" >
|
||||
<p class="problem_tit fl fb c_dblue break_word" >
|
||||
<%= @topic.subject %>
|
||||
</p>
|
||||
<br/>
|
||||
|
@ -51,7 +62,7 @@
|
|||
<% unless @replies.empty? %>
|
||||
<% reply_count = 0 %>
|
||||
<% @replies.each do |message| %>
|
||||
<div class="ping_C mb10" id="<%= "message-#{message.id}" %>">
|
||||
<div class="ping_C mb10 ml50" id="<%= "message-#{message.id}" %>">
|
||||
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop upload_img">
|
||||
|
|
|
@ -215,3 +215,11 @@ production:
|
|||
# specific configuration options for development environment
|
||||
# that overrides the default ones
|
||||
development:
|
||||
delivery_method: :smtp
|
||||
smtp_settings:
|
||||
address: mail.trustie.net
|
||||
port: 25
|
||||
domain: mail.trustie.net
|
||||
authentication: :login
|
||||
user_name: "mail@trustie.net"
|
||||
password: "loong2010"
|
||||
|
|
|
@ -68,6 +68,7 @@ zh:
|
|||
label_user_extensions: 其他信息
|
||||
|
||||
notice_account_updated: 帐号更新成功
|
||||
notice_mail_notification_updated: 邮件通知设置成功
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -80,7 +80,7 @@ zh:
|
|||
field_enterprise_name: 组织
|
||||
|
||||
label_week_mail: 一周动态
|
||||
label_day_mail: 今日动态
|
||||
label_day_mail: 您好!Trustie平台上与您相关的今日动态
|
||||
#added by huang
|
||||
field_tea_name: 教师
|
||||
field_couurse_time: 学时
|
||||
|
@ -744,9 +744,10 @@ zh:
|
|||
label_theme: 主题
|
||||
label_default: 默认
|
||||
label_search_titles_only: 仅在标题中搜索
|
||||
label_user_mail_option_all: "收取我的所有通知"
|
||||
label_user_mail_option_all: "实时发送邮件"
|
||||
label_user_mail_option_day: "按日发送邮件"
|
||||
label_user_mail_option_none: "不发送邮件"
|
||||
label_user_mail_option_week: "按周收取我的所有通知"
|
||||
label_user_mail_option_day: "按天收取我的所有通知"
|
||||
label_must_answer: "必答"
|
||||
label_poll_title: 问卷调查_问卷页面
|
||||
#huang
|
||||
|
@ -782,7 +783,6 @@ zh:
|
|||
label_project_cousre_studentun: "你还未加入任何课程,赶快加入吧!"
|
||||
#end by huang
|
||||
label_user_mail_option_selected: "收取选中项目的所有通知"
|
||||
label_user_mail_option_none: "不收取任何通知"
|
||||
label_user_mail_option_only_my_events: "只收取我跟踪或参与的项目的通知"
|
||||
label_user_mail_option_only_assigned: "只收取分配给我的"
|
||||
label_user_mail_option_only_owner: 只收取由我创建的
|
||||
|
|
|
@ -109,6 +109,7 @@ RedmineApp::Application.routes.draw do
|
|||
namespace :test do
|
||||
match 'courselist'
|
||||
match 'zip'
|
||||
match 'mailer'
|
||||
end
|
||||
##new added by linchun #以发布应用的形式参与竞赛
|
||||
resources :softapplications do
|
||||
|
@ -328,6 +329,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'my/add_block', :via => :post
|
||||
match 'my/remove_block', :via => :post
|
||||
match 'my/order_blocks', :via => :post
|
||||
match 'my/change_mail_notification', via: :get
|
||||
|
||||
get 'my/page2', :to => 'my#page2', :as => "my_page2"
|
||||
|
||||
|
|
2934
db/schema.rb
2934
db/schema.rb
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -8,6 +8,7 @@
|
|||
*******************************************************************************/
|
||||
|
||||
KindEditor.lang({
|
||||
imagedirectupload:'本地图片',
|
||||
source : 'HTML代码',
|
||||
preview : '预览',
|
||||
undo : '后退(Ctrl+Z)',
|
||||
|
|
|
@ -413,6 +413,13 @@
|
|||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.ke-icon-imagedirectupload
|
||||
{
|
||||
background-position: 0px -1232px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
/* container */
|
||||
.ke-container {
|
||||
display: block;
|
||||
|
|
|
@ -995,18 +995,24 @@ pre,code,.line-code
|
|||
font-family:'Source Code Pro'
|
||||
}
|
||||
/*by young*/
|
||||
#main,#footer,#top-menu,#header
|
||||
#main,#top-menu,#header
|
||||
{
|
||||
|
||||
width:940px;
|
||||
margin:25px auto
|
||||
}
|
||||
#footer {
|
||||
margin:25px auto
|
||||
}
|
||||
#main
|
||||
{
|
||||
width:940px;
|
||||
height:auto;
|
||||
margin:0px auto;
|
||||
}
|
||||
#main #content_{
|
||||
margin-bottom: 10px;:w
|
||||
}
|
||||
#header
|
||||
{
|
||||
width:925px;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
|
||||
require 'delayed/command'
|
||||
Delayed::Command.new(ARGV).daemonize
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
|
||||
require 'delayed/command'
|
||||
Delayed::Command.new(ARGV).daemonize
|
||||
|
|
Loading…
Reference in New Issue