From 73798a0da453a4e9f0fb675f89a442d7967451bd Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 30 Apr 2015 07:22:47 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E4=B8=A4=E6=AC=A1=E7=82=B9=E5=87=BB500=E9=94=99=E8=AF=AF=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD=EF=BC=9A=E5=9C=A8=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=8F=90=E4=BA=A4=E6=97=B6=E4=BB=A3=E7=A0=81=E5=90=8E?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=9B=E5=BB=BA=E7=94=A8=E6=88=B7=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 13 +++---------- app/models/mailer.rb | 19 +++++++++++++++---- app/models/principal.rb | 1 + 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 845f32dab..76e136216 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -248,16 +248,9 @@ class ProjectsController < ApplicationController # 2、加入项目、创建角色 # 3、用户得分 if params[:login] - login = params[:login] - login = login.sub(/%40/,'@') - mail = params[:login] - password = params[:password] - us = UsersService.new - user = us.register_auto(login,mail, password) - - Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id) - UserGrade.create(:user_id => user.id, :project_id => @project.id) - User.current = user unless User.current.nil? + # 自动激活用户 + user.status = 1 + user.save end if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return diff --git a/app/models/mailer.rb b/app/models/mailer.rb index a930b5467..e67d042e1 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -33,7 +33,7 @@ class Mailer < ActionMailer::Base @target = cls end def method_missing(name, *args, &block) - if Setting.delayjob_enabled && Object.const_defined?('Delayed') + if Setting.delayjob_enabled? && Object.const_defined?('Delayed') @target.delay.send(name, *args, &block) else @target.send(name, *args, &block).deliver @@ -52,9 +52,20 @@ class Mailer < ActionMailer::Base @email = email @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} " @password = newpass(6) - @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, - :password => @password, - :login => email) + + login = email + login = login.sub(/%40/,'@') + us = UsersService.new + # 自动激活用户 + user = us.register_auto(login, @email, @password) + + Member.create(:role_ids => [4], :user_id => user.id,:project_id => project.id) + UserGrade.create(:user_id => user.id, :project_id => project.id) + User.current = user unless User.current.nil? + @user = user + @token = Token.get_token_from_user(user, 'autologin') + @project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,:user => user, :token => @token.value + ) mail :to => email, :subject => @subject end diff --git a/app/models/principal.rb b/app/models/principal.rb index dfec5b911..0f0746f78 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -19,6 +19,7 @@ class Principal < ActiveRecord::Base self.table_name = "#{table_name_prefix}users#{table_name_suffix}" # Account statuses + # 0 全部;1 活动的; 2 已注册; 3 锁定 STATUS_ANONYMOUS = 0 STATUS_ACTIVE = 1 STATUS_REGISTERED = 2 From 389266e3e539a35e417b30f46d13e96fcaa55c6f Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 30 Apr 2015 07:46:07 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=8B=A5=E6=9C=89=E7=9A=84=E6=9D=83=E9=99=90?= =?UTF-8?q?=20=E7=AE=A1=E7=90=86=E5=91=98--=E9=85=8D=E7=BD=AE=E3=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=B1=BB=E5=9E=8B=20=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E4=BA=BA=E5=91=98--=20=E9=85=8D=E7=BD=AE=E3=80=81=E9=80=80?= =?UTF-8?q?=E5=87=BA=E9=A1=B9=E7=9B=AE=20=E6=8A=A5=E5=91=8A=E8=80=85--=20?= =?UTF-8?q?=E9=80=80=E5=87=BA=E9=A1=B9=E7=9B=AE=EF=BC=88admin=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E9=85=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_join_exit_project.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index ba3300d44..83352de9d 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -12,12 +12,12 @@ <%= link_to "#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %> <% end %> - <% if (User.current.login? && User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s.include?("Manager")) || User.current.admin? %> + <% if (User.current.login? && User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager")) || User.current.admin? %> <%= link_to "#{text}".html_safe,"javascript:void(0)" ,:onClick => "show_window();", :class => "pr_join_a",:id => "setting_project_type"%> <% end %> <% if (User.current.member_of? @project) && User.current.login? && !User.current.admin && - !Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s.include?("Manager") %> + !Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %> <%= exit_project_link(@project) %> <% end %> From 0a8f3faf6aaab8506450880dfc76ebc2777c0a44 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 30 Apr 2015 09:02:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1=E3=80=81project.css=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=202=E3=80=81=E9=A1=B9=E7=9B=AE=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E8=B5=84=E6=BA=90=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_project_file_new.html.erb | 2 +- public/stylesheets/project.css | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/files/_project_file_new.html.erb b/app/views/files/_project_file_new.html.erb index f71783ba2..e94e27784 100644 --- a/app/views/files/_project_file_new.html.erb +++ b/app/views/files/_project_file_new.html.erb @@ -5,7 +5,7 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>'); showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("") + $('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","40%").css("left","30%"); $('#ajax-modal').parent().addClass("popbox_polls"); } diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 4f9c6ec78..27a32b18a 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -222,7 +222,7 @@ a:hover.ping_sub{ background:#14a8b9;} /*.ping_distop span a{ float:right; width:20px; height:20px; background:url(images/star.png) -24px 0 no-repeat; margin-right:3px;}*/ /*上传资源弹出框样式*/ -/*#popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}*/ +.popbox_polls{position:fixed !important;} .upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;} .upload_box{ width:430px; margin:15px auto;} @@ -338,7 +338,7 @@ a:hover.st_add{ color:#ff8e15;} .newpro_box input{ height:26px; float:left; margin-bottom:10px;} .newpro_box textarea{ height:150px; float:left; margin-bottom:10px;} .newpro_box select{ height:29px; float:left; margin-bottom:10px;} -.label{ width:80px; text-align:right; font-size:14 background-image: url(../images/true.png); } +.label{ width:80px; text-align:right; font-size:14px; background-image: url(../images/true.png); } .icon-reload { background-image: url(../images/reload.png); } .icon { background-position: 0% 50%; @@ -433,7 +433,7 @@ span.add_attachment a {padding-left:16px; background: url(../images/bullet_add.p /*日历选择图*/ img.ui-datepicker-trigger { display:block; - background:url(/images/public_icon.png) -31px 0 no-repeat; + background:url(../images/public_icon.png) -31px 0 no-repeat; cursor: pointer; vertical-align: middle; margin-left: 5px; From b67f40173865e3acdb83f98f57b5a40ef3ccf2b2 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 30 Apr 2015 09:15:48 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=BC=95=E5=85=A5=E6=88=91=E7=9A=84?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_project_file_new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/files/_project_file_new.html.erb b/app/views/files/_project_file_new.html.erb index e94e27784..1e217f991 100644 --- a/app/views/files/_project_file_new.html.erb +++ b/app/views/files/_project_file_new.html.erb @@ -6,7 +6,7 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); - $('#ajax-modal').parent().css("top","40%").css("left","30%"); + $('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().addClass("popbox_polls"); } From 2f4ac77838876d1d5c4752c3389f645396fa18f8 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 30 Apr 2015 09:25:16 +0800 Subject: [PATCH 5/5] schema --- db/schema.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/db/schema.rb b/db/schema.rb index dcbe017fb..006b26e91 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -654,6 +654,16 @@ ActiveRecord::Schema.define(:version => 20150428021035) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id"