Merge branch 'szzh' into Poll

Conflicts:
	app/views/layouts/_base_feedback.html.erb
This commit is contained in:
sw 2015-01-17 15:03:59 +08:00
commit 1e8c6374d7
26 changed files with 348 additions and 104 deletions

View File

@ -2,6 +2,7 @@
<launchConfiguration type="com.aptana.js.debug.core.webbrowserLaunchConfigurationType"> <launchConfiguration type="com.aptana.js.debug.core.webbrowserLaunchConfigurationType">
<booleanAttribute key="advancedRunEnabled" value="false"/> <booleanAttribute key="advancedRunEnabled" value="false"/>
<booleanAttribute key="appendProjectName" value="true"/> <booleanAttribute key="appendProjectName" value="true"/>
<stringAttribute key="browserCmdLine" value=""/>
<stringAttribute key="browserExecutable" value=""/> <stringAttribute key="browserExecutable" value=""/>
<stringAttribute key="browserNature" value="Firefox"/> <stringAttribute key="browserNature" value="Firefox"/>
<stringAttribute key="externalBaseUrl" value=""/> <stringAttribute key="externalBaseUrl" value=""/>

View File

@ -2,6 +2,7 @@
<launchConfiguration type="com.aptana.js.debug.core.webbrowserLaunchConfigurationType"> <launchConfiguration type="com.aptana.js.debug.core.webbrowserLaunchConfigurationType">
<booleanAttribute key="advancedRunEnabled" value="false"/> <booleanAttribute key="advancedRunEnabled" value="false"/>
<booleanAttribute key="appendProjectName" value="true"/> <booleanAttribute key="appendProjectName" value="true"/>
<stringAttribute key="browserCmdLine" value=""/>
<stringAttribute key="browserExecutable" value="C:\Program Files (x86)\Internet Explorer\iexplore.exe"/> <stringAttribute key="browserExecutable" value="C:\Program Files (x86)\Internet Explorer\iexplore.exe"/>
<stringAttribute key="browserNature" value="Internet Explorer"/> <stringAttribute key="browserNature" value="Internet Explorer"/>
<stringAttribute key="externalBaseUrl" value=""/> <stringAttribute key="externalBaseUrl" value=""/>

View File

@ -156,7 +156,16 @@ class ApplicationController < ActionController::Base
user user
end end
end end
def try_to_autologin1
# auto-login feature starts a new session
user = User.try_to_autologin(params[:token])
if user
start_user_session(user)
end
user
end
# Sets the logged in user # Sets the logged in user
def logged_user=(user) def logged_user=(user)
reset_session reset_session
@ -248,7 +257,30 @@ class ApplicationController < ActionController::Base
end end
end end
end end
def authorize1(ctrl = params[:controller], action = params[:action],token = params[:token], global = false)
if(!User.current.logged? && !token.nil?)
User.current =try_to_autologin1
end
allowed = authorize_allowed(params[:controller], params[:action],global)
if allowed
true
else
if @project && @project.archived?
render_403 :message => :notice_not_authorized_archived_project
else
deny_access
end
end
end
def auth_login1(token = params[:token])
if(!User.current.logged? && !token.nil?)
User.current =try_to_autologin1
end
end
def authorize_allowed(ctrl = params[:controller], action = params[:action], global = false) def authorize_allowed(ctrl = params[:controller], action = params[:action], global = false)
#modify by NWB #modify by NWB
if @project if @project
@ -261,6 +293,7 @@ class ApplicationController < ActionController::Base
allowed allowed
end end
def authorize_attachment_download(ctrl = params[:controller], action = params[:action], global = false) def authorize_attachment_download(ctrl = params[:controller], action = params[:action], global = false)
case @attachment.container_type case @attachment.container_type
when "Memo" when "Memo"
allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true) allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
@ -289,6 +322,37 @@ class ApplicationController < ActionController::Base
end end
end end
def authorize_attachment_download1(ctrl = params[:controller], action = params[:action],token = params[:token], global = false)
if(!User.current.logged? && !token.nil?)
User.current = try_to_autologin1
end
case @attachment.container_type
when "Memo"
allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
when "Message"
if @project
allowed = User.current.allowed_to?(:projects_attachments_download,@project,:global => false)
elsif @course
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
end
when "contest"
return true
when "Course"
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
else
return true
end
if allowed
true
else
if @project && @project.archived?
render_403 :message => :notice_not_authorized_archived_project
else
deny_access
end
end
end
def authorize_course(ctrl = params[:controller], action = params[:action], global = false) def authorize_course(ctrl = params[:controller], action = params[:action], global = false)
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @course, :global => global) allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @course, :global => global)
if allowed if allowed
@ -789,4 +853,29 @@ class ApplicationController < ActionController::Base
@organizer = WebFooterOranizer.first @organizer = WebFooterOranizer.first
@companies = WebFooterCompany.all @companies = WebFooterCompany.all
end end
def password_authentication
user, last_login_on = User.try_to_login(params[:user_name], params[:password])
successful_authentication(user, last_login_on)
end
def successful_authentication(user, last_login_on)
logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}"
# Valid user
self.logged_user = user
# generate a key and set cookie if autologin
if params[:autologin] && Setting.autologin?
set_autologin_cookie(user)
end
call_hook(:controller_account_success_authentication_after, {:user => user })
end
end end

View File

@ -17,11 +17,12 @@
class AttachmentsController < ApplicationController class AttachmentsController < ApplicationController
layout "users_base" layout "users_base"
before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete] before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete]
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
before_filter :delete_authorize, :only => :destroy before_filter :delete_authorize, :only => :destroy
before_filter :authorize_global, :only => :upload before_filter :authorize_global, :only => :upload
before_filter :authorize_attachment_download, :only => :download before_filter :authorize_attachment_download1, :only => :download
#before_filter :login_without_softapplication, only: [:download] #before_filter :login_without_softapplication, only: [:download]
accept_api_auth :show, :download, :upload accept_api_auth :show, :download, :upload
require 'iconv' require 'iconv'

View File

@ -19,10 +19,13 @@ class IssuesController < ApplicationController
layout 'base_projects'#Added by young layout 'base_projects'#Added by young
default_search_scope :issues default_search_scope :issues
before_filter :authorize1, :only => [:show]
before_filter :find_issue, :only => [:show, :edit, :update] before_filter :find_issue, :only => [:show, :edit, :update]
before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
before_filter :find_project, :only => [:new, :create, :update_form] before_filter :find_project, :only => [:new, :create, :update_form]
#before_filter :authorize, :except => [:index, :show]
before_filter :authorize, :except => [:index] before_filter :authorize, :except => [:index]
before_filter :find_optional_project, :only => [:index] before_filter :find_optional_project, :only => [:index]
before_filter :check_for_default_issue_status, :only => [:new, :create] before_filter :check_for_default_issue_status, :only => [:new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create, :update_form] before_filter :build_new_issue_from_params, :only => [:new, :create, :update_form]

View File

@ -17,6 +17,9 @@
class MyController < ApplicationController class MyController < ApplicationController
layout "users_base" layout "users_base"
# edit
before_filter :auth_login1, :only => [:account]
#
before_filter :require_login before_filter :require_login
helper :issues helper :issues

View File

@ -32,13 +32,15 @@ class ProjectsController < ApplicationController
menu_item l(:label_course_file), :only => :index menu_item l(:label_course_file), :only => :index
menu_item l(:label_course_news), :only => :index menu_item l(:label_course_news), :only => :index
# edit
before_filter :authorize1, :only => [:show]
#
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches] before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
# :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share,
# :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index]
#此条勿删 课程相关权限 ,:new_homework,:homework,:feedback,,:member #此条勿删 课程相关权限 ,:new_homework,:homework,:feedback,,:member
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize, :only => [:settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :file, :statistics, :watcherlist before_filter :file, :statistics, :watcherlist

View File

@ -15,8 +15,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class UsersController < ApplicationController class UsersController < ApplicationController
layout :setting_layout layout :setting_layout
#Added by young #Added by young
before_filter :auth_login1, :only => [:show, :user_activities]
menu_item :activity menu_item :activity
menu_item :user_information, :only => :info menu_item :user_information, :only => :info
menu_item :user_course, :only => :user_courses menu_item :user_course, :only => :user_courses
@ -29,6 +31,9 @@ class UsersController < ApplicationController
#Ended by young #Ended by young
# edit
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks] before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
@ -41,7 +46,7 @@ class UsersController < ApplicationController
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
before_filter :auth_user_extension, only: :show before_filter :auth_user_extension, only: :show
before_filter :rest_user_score, only: :show #before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects #before_filter :select_entry, only: :user_projects
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx

View File

@ -140,10 +140,12 @@ module ApplicationHelper
# * :text - Link text (default to attachment filename) # * :text - Link text (default to attachment filename)
# * :download - Force download (default: false) # * :download - Force download (default: false)
def link_to_attachment(attachment, options={}) def link_to_attachment(attachment, options={})
token = options[:token] if options[:token]
text = options.delete(:text) || attachment.filename text = options.delete(:text) || attachment.filename
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
html_options = options.slice!(:only_path) html_options = options.slice!(:only_path)
url = send(route_method, attachment, attachment.filename, options) url = send(route_method, attachment, attachment.filename, options)
url << "?token=#{token}" unless token.nil?
link_to text, url, html_options link_to text, url, html_options
end end

View File

@ -224,6 +224,7 @@ module IssuesHelper
# as an array of strings # as an array of strings
def details_to_strings(details, no_html=false, options={}) def details_to_strings(details, no_html=false, options={})
options[:only_path] = (options[:only_path] == false ? false : true) options[:only_path] = (options[:only_path] == false ? false : true)
options[:token] = options[:token] if options[:token]
strings = [] strings = []
values_by_field = {} values_by_field = {}
details.each do |detail| details.each do |detail|
@ -312,7 +313,11 @@ module IssuesHelper
old_value = content_tag("del", old_value) if detail.old_value and detail.value.blank? old_value = content_tag("del", old_value) if detail.old_value and detail.value.blank?
if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key) if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key)
# Link to the attachment if it has not been removed # Link to the attachment if it has not been removed
if options[:token].nil?
value = link_to_attachment(atta, :download => true, :only_path => options[:only_path]) value = link_to_attachment(atta, :download => true, :only_path => options[:only_path])
else
value = link_to_attachment(atta, :download => true, :only_path => options[:only_path], :token => options[:token])
end
if options[:only_path] != false && atta.is_text? if options[:only_path] != false && atta.is_text?
value += link_to( value += link_to(
image_tag('magnifier.png'), image_tag('magnifier.png'),

View File

@ -18,8 +18,12 @@
class IssueObserver < ActiveRecord::Observer class IssueObserver < ActiveRecord::Observer
def after_create(issue) def after_create(issue)
thread1=Thread.new do Thread.start do
Mailer.issue_add(issue).deliver if Setting.notified_events.include?('issue_added') recipients = issue.recipients
recipients.each do |rec|
Mailer.issue_add(issue,rec).deliver if Setting.notified_events.include?('issue_added')
end end
end end
end
end end

View File

@ -20,7 +20,11 @@ class IssueOverdue < ActiveRecord::Base
#发邮件 #发邮件
#puts "11" + issue.id.to_s #puts "11" + issue.id.to_s
#Mailer.issue_expire(issue).deliver #Mailer.issue_expire(issue).deliver
Mailer.issue_add(issue).deliver recipients = issue.recipients
recipients.each do |rec|
Mailer.issue_edit(issue,rec).deliver
end
break break
end end
end end

View File

@ -23,8 +23,12 @@ class JournalObserver < ActiveRecord::Observer
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) || (Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?) (Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
) )
Thread.new do Thread.start do
Mailer.issue_edit(journal).deliver recipients = journal.recipients
recipients.each do |rec|
Mailer.issue_edit(journal,rec).deliver
end
end end
end end
end end

View File

@ -95,29 +95,50 @@ class Mailer < ActionMailer::Base
# Example: # Example:
# issue_add(issue) => Mail::Message object # issue_add(issue) => Mail::Message object
# Mailer.issue_add(issue).deliver => sends an email to issue recipients # Mailer.issue_add(issue).deliver => sends an email to issue recipients
def issue_add(issue) def issue_add(issue, recipients)
issue_id = issue.project_index issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier, redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue_id, 'Issue-Id' => issue_id,
'Issue-Author' => issue.author.login 'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue message_id issue
@author = issue.author @author = issue.author
@issue = issue @issue = issue
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) user = User.find_by_mail(recipients)
recipients = issue.recipients
cc = issue.watcher_recipients - recipients token = Token.new(:user =>user , :action => 'autologin')
mail :to => recipients, token.save
@token = token
@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))
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
@user_url = url_for(my_account_url(user,:token => @token.value))
cc = issue.watcher_recipients - issue.recipients
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
mail(:to => recipients,
:cc => cc, :cc => cc,
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" :subject => subject)
end end
# issue.attachments.each do |attach|
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
# end
# cc = issue.watcher_recipients - recipients
#mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll")
# Builds a Mail::Message object used to email recipients of the edited issue. # Builds a Mail::Message object used to email recipients of the edited issue.
# #
# Example: # Example:
# issue_edit(journal) => Mail::Message object # issue_edit(journal) => Mail::Message object
# Mailer.issue_edit(journal).deliver => sends an email to issue recipients # Mailer.issue_edit(journal).deliver => sends an email to issue recipients
def issue_edit(journal) def issue_edit(journal,recipients)
issue = journal.journalized.reload issue = journal.journalized.reload
issue_id = issue.project_index issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier, redmine_headers 'Project' => issue.project.identifier,
@ -127,18 +148,42 @@ class Mailer < ActionMailer::Base
message_id journal message_id journal
references issue references issue
@author = journal.user @author = journal.user
recipients = journal.recipients
user = User.find_by_mail(recipients)
token = Token.new(:user =>user , :action => 'autologin')
token.save
@token = token
# edit
@issue_author_url = url_for(:controller => 'users', :action => 'show', :id => issue.author_id, :token => @token.value)
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
@user_url = url_for(my_account_url(user,:token => @token.value))
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
# Watchers in cc # Watchers in cc
cc = journal.watcher_recipients - recipients
cc = journal.watcher_recipients - journal.recipients
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] " s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id') s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << issue.subject s << issue.subject
@issue = issue @issue = issue
@journal = journal @journal = journal
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
mail :to => recipients, mail(:to => recipients,
:cc => cc, :cc => cc,
:subject => s :subject => s)
end
def self.deliver_mailer(to,cc, subject)
mail :to => to,
:cc => cc,
:subject => subject
end end
# 用户申请加入项目邮件通知 # 用户申请加入项目邮件通知
@ -615,5 +660,15 @@ class Mailer < ActionMailer::Base
Rails.logger Rails.logger
end end
def add_attachments(obj)
if email.attachments && email.attachments.any?
email.attachments.each do |attachment|
obj.attachments << Attachment.create(:container => obj,
:file => attachment.decoded,
:filename => attachment.filename,
:author => user,
:content_type => attachment.mime_type)
end
end
end
end end

View File

@ -380,7 +380,7 @@ class User < Principal
raise text raise text
end end
# Returns the user who matches the given autologin +key+ or nil
def self.try_to_autologin(key) def self.try_to_autologin(key)
user = Token.find_active_user('autologin', key, Setting.autologin.to_i) user = Token.find_active_user('autologin', key, Setting.autologin.to_i)
if user if user
@ -466,7 +466,11 @@ class User < Principal
User.hash_password("#{salt}#{User.hash_password clear_password}") == hashed_password User.hash_password("#{salt}#{User.hash_password clear_password}") == hashed_password
end end
end end
def check_password1?(clear_password)
clear_password == hashed_password
end
# Generates a random salt and computes hashed_password for +clear_password+ # Generates a random salt and computes hashed_password for +clear_password+
# The hashed password is stored in the following form: SHA1(salt + SHA1(password)) # The hashed password is stored in the following form: SHA1(salt + SHA1(password))
def salt_password(clear_password) def salt_password(clear_password)

View File

@ -36,6 +36,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_attach/praise_alert') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_attach/praise_alert') %>');
showModal('ajax-modal', '480px'); showModal('ajax-modal', '480px');
$('#ajax-modal').css('height','240px'); $('#ajax-modal').css('height','240px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='#' onclick='hiddent_alert_model();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); "<a href='#' onclick='hiddent_alert_model();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("width","511"); $('#ajax-modal').parent().css("top","").css("left","").css("width","511");

View File

@ -1,33 +1,46 @@
<html> <html>
<head> <head>
<title>Trustie项目邮件</title>
<style> <style>
body { body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
font-family: Verdana, sans-serif; div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,ol{ margin:0; padding:0;}
font-size: 0.8em; div,img,tr,td,table{ border:0;}
color:#484848; table,tr,td{border:0;cellspacing:0; cellpadding:0;}
} ol,ul,li{ list-style-type:none}
h1, h3, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin: 0px; } .cl{ clear:both; overflow:hidden; }
h1 { font-size: 1.2em; } a{ text-decoration:none; }
h3, h3 { font-size: 1.1em; } a:hover{ text-decoration:underline; }
a, a:link, a:visited { color: #2A5685;} .mail_box,ul,li{ list-style-type:none}
a:hover, a:active { color: #c61a1a; } .mail{ width:600px; margin:20px; height:auto; color:#4b4b4b; font-size:14px; }
a.wiki-anchor { display: none; } .mail a{color:#1b55a7; font-weight: bold; }
hr { .mail_content{ margin-top:30px;}
width: 100%; .c_blue{ color:#1b55a7;}
height: 1px; .mail_box{ border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;}
background: #ccc; .mail_box_p{ float:left; display: block; width:527px;}
border: 0; a.mail_reply{ display:block; float:right; width:80px; text-align:center; height:30px; background:#15bccf; color:#fff; font-weight:normal; font-size:14px;}
} a:hover.mail_reply{ background:#06a9bc; text-decoration:none;}
.footer { .mail_fujian{ float:left; width:527px; display: block; }
/*font-size: 0.8em;*/ .mail_fujian a{ font-weight:normal; font-size:12px;}
/*font-style: italic;*/ .mail_foot a{ font-size:12px; font-weight:normal;}
}
</style> </style>
</head> </head>
<body> <body>
<span class="header"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_header).html_safe %></span> <div class="container">
<div class="mail">
<div class="mail_head">
<p>亲爱的Trustie用户您好</p>
</div><!--mail_head end-->
<%= yield %> <%= yield %>
<hr /> <hr />
<span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer).html_safe %></span> <div class="mail_foot"><%= link_to("退订该邮件?", @user_url) %> </div><!--mail_foot end-->
</div>
</div>
</body> </body>
</html> </html>

View File

@ -1,15 +1,42 @@
<h1><%= link_to(h("#{issue.tracker.name} ##{issue.project_index}: #{issue.subject}"), issue_url) %></h1> <!-- <h1><%#= link_to(h("#{issue.tracker.name} ##{issue.project_index}: #{issue.subject}"), issue_url) %></h1> -->
<p>
<span class="c_blue">
<%= link_to(h("#{@issue.author}(#{@issue.author.show_name})"), @issue_author_url) %>
</span>在
<span class="c_blue"><%= link_to(h("#{@issue.project.name}"),@project_url) %></span>中有了一个与您相关的最新活动,请您关注!</p>
<div class="mail_box">
<ul> <ul>
<li><%=l(:field_author)%>: <%=h issue.author %></li> <li style="list-style-type:none"><span style="float: left"><strong>标题:</strong></span><span style="float: left; width: 500px"><%= link_to(issue.subject, issue_url) %></span></li>
<li><%=l(:field_status)%>: <%=h issue.status %></li> <li style="list-style-type:none"><span style="float: left"> <strong>来源:</strong></span><span style="float: left; width: 500px"><%= issue.project.name %><b>|&nbsp;</b>项目<%= issue.tracker.name%></span></li>
<li><%=l(:field_priority)%>: <%=h issue.priority %></li> <li style="list-style-type:none"><span style="float: left"> <strong >内容:</strong></span><span style="float: left; width: 500px">
<li><%=l(:field_assigned_to)%>: <%=h issue.assigned_to %></li> <%= issue.description %></span>
<li><%=l(:field_category)%>: <%=h issue.category %></li> </li>
<li><%=l(:field_fixed_version)%>: <%=h issue.fixed_version %></li> <li style="list-style-type:none">
<% issue.custom_field_values.each do |c| %>
<li><%=h c.custom_field.name %>: <%=h show_value(c) %></li>
<% end %>
</ul>
<%= textilizable(issue, :description, :only_path => false) %> <% unless @issue.attachments.nil? %>
<span style="float: left"> <strong>附件:</strong>
</span><span style="float: left; width: 500px">
<% @issue.attachments.each do |attach| %>
<p><%= link_to_attachment(attach, :download => true, :token => @token.value, :only_path => false) %></p>
<% end %></span>
<% end %>
</li>
</ul>
<div class="cl"></div>
<label class="mail_reply"><%= link_to( "我要回复", issue_url, :class => "mail_reply") %></label>
<div class="cl"></div>
</div>
<!-- <li><%#=l(:field_author)%>: <%#=h issue.author %></li>
<li><%#=l(:field_status)%>: <%#=h issue.status %></li>
<li><%#=l(:field_priority)%>: <%#=h issue.priority %></li>
<li><%#=l(:field_assigned_to)%>: <%#=h issue.assigned_to %></li>
<li><%#=l(:field_category)%>: <%#=h issue.category %></li>
<li><%#=l(:field_fixed_version)%>: <%#=h issue.fixed_version %></li>
-->
<%# issue.custom_field_values.each do |c| %>
<!-- <li><%#=h c.custom_field.name %>: <%#=h show_value(c) %></li>
<%#end %>
-->

View File

@ -1,13 +1,19 @@
<%= "#{issue.tracker.name} ##{issue.project_index}: #{issue.subject}" %>
<%= issue_url %>
* <%=l(:field_author)%>: <%= issue.author %> <%= link_to(h("#{@issue.author}(#{@issue.author.show_name})"), @issue_author_url) %>
* <%=l(:field_status)%>: <%= issue.status %>
* <%=l(:field_priority)%>: <%= issue.priority %> <%= link_to(h("#{@issue.project.name}"),@project_url) %>中有了一个与您相关的最新活动,请您关注!
* <%=l(:field_assigned_to)%>: <%= issue.assigned_to %> 标题:<%= link_to(issue.subject, issue_url) %>
* <%=l(:field_category)%>: <%= issue.category %> 来源:<%= issue.project.name %>|&nbsp;项目缺陷<
* <%=l(:field_fixed_version)%>: <%= issue.fixed_version %> 内容:
<% issue.custom_field_values.each do |c| %>* <%= c.custom_field.name %>: <%= show_value(c) %>
<% end -%>
----------------------------------------
<%= issue.description %> <%= issue.description %>
<% unless @issue.attachments.nil? %>
附件:
<% @issue.attachments.each do |attach| %>
<%= link_to_attachment(attach, :download => true, :token => @token.value, :only_path => false) %><%= l(:label_added) %>
<% end %>
<% end %>
<%= link_to( "我要回复", issue_url) %>

View File

@ -1,3 +1,8 @@
<%= l(:text_issue_added, :id => "##{@issue.project_index}", :author => h(@issue.author)) %> <div class="mail_content">
<hr />
<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %> <%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %>
</div>

View File

@ -1,4 +1,2 @@
<%= l(:text_issue_added, :id => "##{@issue.project_index}", :author => @issue.author) %>
----------------------------------------
<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %> <%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %>

View File

@ -1,11 +1,13 @@
<%= l(:text_issue_updated, :id => "##{@issue.project_index}", :author => h(@journal.user)) %> <%= l(:text_issue_updated, :id => "##{@issue.project_index}", :author => h(@journal.user)) %>
<ul> <ul>
<% details_to_strings(@journal.details, false, :only_path => false).each do |string| %> <% details_to_strings(@journal.details, false, :only_path => false, :token => @token.value).each do |string| %>
<% if (!string.include? l(:label_attachment)) && (!string.include? "attachments") %>
<li><%= string %></li> <li><%= string %></li>
<% end %> <% end %>
<% end %>
</ul> </ul>
<%= textilizable(@journal, :notes, :only_path => false) %> <span style="float: left"><strong><%= l(:field_content)%></strong></span><span style="float: left; width: 540px"><%= @journal.notes %></span>
<hr /> <hr />
<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %> <%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %>

View File

@ -1,11 +1,13 @@
<%= l(:text_issue_updated, :id => "##{@issue.project_index}", :author => @journal.user) %> <%= l(:text_issue_updated, :id => "##{@issue.project_index}", :author => @journal.user) %>
<% details_to_strings(@journal.details, true).each do |string| -%> <% details_to_strings(@journal.details, true, :token => @token.value).each do |string| -%>
<%= string %> <% if (!string.include? l(:label_attachment)) && (!string.include? "attachments") %>
<li><%= string %></li>
<% end %>
<% end -%> <% end -%>
<% if @journal.notes? -%> <% if @journal.notes? -%>
<%= @journal.notes %> <%= l(:field_content)%><%= @journal.notes %>
<% end -%> <% end -%>
---------------------------------------- ----------------------------------------

View File

@ -123,7 +123,7 @@
<br/> <br/>
</p> </p>
<p style="width:400px;padding-left: 52px;"> <p style="width:400px;padding-left: 50px;">
<label style="margin-right: 1px;"> <label style="margin-right: 1px;">
<%= l(:label_identity) %><span style="color: #bb0000;"> *</span></label> <%= l(:label_identity) %><span style="color: #bb0000;"> *</span></label>
<select onchange="showtechnical_title(this.value, $('#userTechnical_title'));" name="identity" id="userIdentity" class="location" style="margin: 0px;"> <select onchange="showtechnical_title(this.value, $('#userTechnical_title'));" name="identity" id="userIdentity" class="location" style="margin: 0px;">
@ -187,13 +187,13 @@
<!-- added by bai 增加账户里的性别--> <!-- added by bai 增加账户里的性别-->
<span id='gender' style='display:none'> <span id='gender' style='display:none'>
<% if @user.user_extensions.nil? %> <% if @user.user_extensions.nil? %>
<p style="width:400px;padding-left: 54px;"> <p style="width:400px;padding-left: 52px;">
<%= l(:label_gender) %>&nbsp;&nbsp; <%= l(:label_gender) %>&nbsp;&nbsp;
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %> <%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
</p> </p>
<% else %> <% else %>
<% if @user.user_extensions.gender == 0 %><!-- label_gender_male --> <% if @user.user_extensions.gender == 0 %><!-- label_gender_male -->
<p style="width:400px;padding-left: 54px;"> <p style="width:400px;padding-left: 52px;">
<%= l(:label_gender) %>&nbsp;&nbsp; <%= l(:label_gender) %>&nbsp;&nbsp;
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %> <%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
</p> </p>
@ -318,7 +318,7 @@
}); });
</script> </script>
<p style="width:400px;padding-left: 57px;"><label style="margin-right: 5px;"><%= l(:label_location) %></label> <p style="width:400px;padding-left: 55px;"><label style="margin-right: 5px;"><%= l(:label_location) %></label>
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="location"> <select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="location">
<option value="">--请选择省份--</option> <option value="">--请选择省份--</option>
<option value="北京">北京</option> <option value="北京">北京</option>
@ -382,7 +382,7 @@
<legend onclick="toggleFieldset(this);"> <legend onclick="toggleFieldset(this);">
<%= l(:field_mail_notification) %> <%= l(:field_mail_notification) %>
</legend> </legend>
<div style="padding-left: 26px;"> <!-- modified by ming --> <div style="padding-left: 8px;"> <!-- modified by ming -->
<p style="width:380px;"> <p style="width:380px;">
<%= render :partial => 'users/mail_notifications' %> <%= render :partial => 'users/mail_notifications' %>
</p></div> </p></div>

View File

@ -87,12 +87,12 @@ default:
address: smtp.qq.com address: smtp.126.com
port: 587 port: 25
domain: smtp.qq.com domain: smtp.126.com
authentication: :plain authentication: :plain
user_name: 939547590@qq.com user_name: "alanlong9278@126.com"
password: 'suwen11223344' password: "alanlong8788786"
# Absolute path to the directory where attachments are stored. # Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance. # The default is the 'files' directory in your Redmine instance.

View File

@ -91,12 +91,19 @@ module Redmine
ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option." ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option."
scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options)) scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
end end
to = scope.select(:created_on).order("created_on desc").first.created_on unless scope.all(provider_options[:find_options].dup).first.nil?
if options[:course] if provider_options[:timestamp].include? "updated_on"
from = (to - days) > created_time ? (to - days) : created_time.to_date to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.updated_on
else else
from = to - days -1.years to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.created_on
end end
if options[:course]
from = (to - days.days) > created_time ? (to - days.days) : created_time.to_date
else
from = to - days.days - 1.years
end
end
if from && to if from && to
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to]) scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
end end