From b36089c45d1dd73dc13367686f870820c4ac7449 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 16 Jan 2017 11:31:10 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E7=B1=BB=E6=B6=88=E6=81=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 10 +-- app/helpers/users_helper.rb | 2 +- app/models/applied_project.rb | 2 +- db/schema.rb | 93 ++++++++++++--------------- 4 files changed, 47 insertions(+), 60 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index db6aeda94..d3e164844 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -58,7 +58,7 @@ class MembersController < ApplicationController applied_project = @applied_message.applied user = User.find(@applied_message.applied_user_id) project = Project.find(applied_project.project_id) if !applied_project.nil? - if user.member_of?(project)|| AppliedMessage.where(:applied_id => @applied_message.applied_id, :status => 1).count == 0 + if user.member_of?(project)|| AppliedMessage.where(:applied_id => @applied_message.applied_id, :status => 0).count == 0 @flash_message = "该申请已被其他管理员处理" # @applied_message.update_attribute(:status, 2) else @@ -77,7 +77,7 @@ class MembersController < ApplicationController project.user_grades << user_grades unless user_grades.first.user_id.nil? # 添加成功后所有管理员收到的消息状态都要更新 - applied_messages = AppliedMessage.where(:applied_id => @applied_message.applied_id, :project_id => @applied_message.project_id, :status => 1, + applied_messages = AppliedMessage.where(:applied_id => @applied_message.applied_id, :project_id => @applied_message.project_id, :status => 0, :applied_type => "AppliedProject") applied_messages.update_all(:status => 7, :viewed => true) @applied_message = AppliedMessage.find(params[:applied_message_id]) @@ -88,7 +88,7 @@ class MembersController < ApplicationController ps.send_wechat_join_project_notice user,project,ap_role,0 # 添加成功后,批准人收到消息 # AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id , - # :status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id) + # :status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id) rescue Exception => e puts e end @@ -106,7 +106,7 @@ class MembersController < ApplicationController applied_project = @applied_message.applied project = Project.find(@applied_message.project_id) if !applied_project.nil? user = User.find(@applied_message.applied_user_id) - if user.member_of?(project) || AppliedMessage.where(:applied_id => @applied_message.applied_id, :status => 1).count == 0 + if user.member_of?(project) || AppliedMessage.where(:applied_id => @applied_message.applied_id, :status => 0).count == 0 @flash_message = "该申请已被其他管理员处理" # @applied_message.update_attribute(:status, 2) else @@ -115,7 +115,7 @@ class MembersController < ApplicationController :viewed => false, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id) # 拒绝功后所有管理员收到的消息状态都要更新 - applied_messages = AppliedMessage.where(:applied_id => @applied_message.applied_id, :project_id => @applied_message.project_id, :status => 1, + applied_messages = AppliedMessage.where(:applied_id => @applied_message.applied_id, :project_id => @applied_message.project_id, :status => 0, :applied_type => "AppliedProject") applied_messages.update_all(:status => 5, :viewed => true) @applied_message = AppliedMessage.find(params[:applied_message_id]) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index dcac601a4..a2ccab87e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -136,7 +136,7 @@ module UsersHelper end # 判断当前用户能否对消息进行操作 def allow_to_show applied_message - (User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false + (User.current.id == applied_message.user_id && applied_message.status == 0) ? true : false end # 项目申请消息通过状态判断用户 diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb index a6eef8417..87bbf8bf8 100644 --- a/app/models/applied_project.rb +++ b/app/models/applied_project.rb @@ -11,7 +11,7 @@ class AppliedProject < ActiveRecord::Base # 仅仅给项目管理人员发送消息 def send_appliled_message self.project.managers.each do |member| - self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id) + self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => false, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id) #----------------微信通知---------------------- count = ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count diff --git a/db/schema.rb b/db/schema.rb index f638a653c..09866ad15 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20170111030006) do +ActiveRecord::Schema.define(:version => 20170112082231) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -698,8 +698,8 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.string "code" t.integer "time" t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "location" t.string "term" t.string "string" @@ -709,27 +709,28 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.string "class_period" t.integer "school_id" t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 t.integer "lft" t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "is_delete", :default => 0 + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "is_delete", :default => 0 t.integer "end_time" t.string "end_term" - t.integer "is_excellent", :default => 0 - t.integer "excellent_option", :default => 0 - t.integer "is_copy", :default => 0 - t.integer "visits", :default => 0 + t.integer "is_excellent", :default => 0 + t.integer "excellent_option", :default => 0 + t.integer "is_copy", :default => 0 + t.integer "visits", :default => 0 t.integer "syllabus_id" t.string "invite_code" t.string "qrcode" - t.integer "qrcode_expiretime", :default => 0 - t.integer "invite_code_halt", :limit => 1, :default => 0 + t.integer "qrcode_expiretime", :default => 0 + t.integer "professional_level_id", :limit => 1 + t.integer "invite_code_halt", :limit => 1, :default => 0 end add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true @@ -804,19 +805,9 @@ ActiveRecord::Schema.define(:version => 20170111030006) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "delayed_jobs_20161218", :id => false, :force => true do |t| - t.integer "id", :default => 0, :null => false - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" + create_table "disciplines", :force => true do |t| + t.string "name" + t.integer "professional_level_id", :limit => 1 end create_table "discuss_demos", :force => true do |t| @@ -1138,19 +1129,6 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.datetime "updated_at", :null => false end - create_table "ii", :force => true do |t| - t.integer "project_id" - t.string "author_login" - t.string "rep_identifier" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sonar_version", :default => 0 - t.string "path" - t.string "branch" - t.string "language" - t.string "sonar_name" - end - create_table "innodb_monitor", :id => false, :force => true do |t| t.integer "a" end @@ -1687,9 +1665,12 @@ ActiveRecord::Schema.define(:version => 20170111030006) do end create_table "professional_levels", :force => true do |t| - t.string "level" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "level" + end + + create_table "professions", :force => true do |t| + t.string "name" + t.integer "discipline_id", :limit => 1 end create_table "project_infos", :force => true do |t| @@ -1752,7 +1733,6 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.boolean "hidden_repo", :default => false, :null => false t.integer "attachmenttype", :default => 1 t.integer "user_id" - t.integer "dts_test", :default => 0 t.string "enterprise_name" t.integer "organization_id" t.integer "project_new_type" @@ -1760,6 +1740,11 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.integer "forked_from_project_id" t.integer "forked_count" t.integer "publish_resource", :default => 0 + t.integer "boards_count", :default => 0 + t.integer "news_count", :default => 0 + t.integer "acts_count", :default => 0 + t.integer "journals_count", :default => 0 + t.integer "boards_reply_count", :default => 0 t.integer "visits", :default => 0 t.integer "hot", :default => 0 t.string "invite_code" @@ -2082,9 +2067,10 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.integer "score" t.text "comment" t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "appeal_status", :default => 0 + t.boolean "is_hidden", :default => false end add_index "student_works_scores", ["student_work_id"], :name => "student_work_id" @@ -2157,8 +2143,8 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.string "title" t.text "description" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "eng_name" t.integer "syllabus_type" t.integer "credit" @@ -2167,8 +2153,9 @@ ActiveRecord::Schema.define(:version => 20170111030006) do t.integer "practice_hours" t.string "applicable_major" t.string "pre_course" - t.integer "visits", :default => 0 - t.integer "des_status", :default => 0 + t.integer "visits", :default => 0 + t.integer "des_status", :default => 0 + t.integer "professional_level_id", :limit => 1 end add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" From f321082fdc57c99114544c83b19d69afaffac399 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 16 Jan 2017 16:10:28 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=8F=90=E7=A4=BA=E7=AD=96=E7=95=A5=E3=80=81?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=AD=98=E5=82=A8=E8=A1=A8=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 16 ++++++++++---- app/controllers/users_controller.rb | 3 ++- .../_applied_organization_domain_tip.html.erb | 21 +++++++++++++++++++ .../organizations/apply_subdomain.js.erb | 2 ++ app/views/organizations/setting.html.erb | 3 --- 5 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 app/views/organizations/_applied_organization_domain_tip.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index edffdd28b..a6a1334a9 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -635,10 +635,18 @@ class OrganizationsController < ApplicationController end end def apply_subdomain - @organization = Organization.find(params[:id]) - admins = User.where("admin=1") - admins.each do |admin| - OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase) + organization = Organization.find(params[:id]) + @applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase).count + # 如果申请过该名字,怎不能重复申请 + if @applied_message_count > 0 + @flag = true + return + else + admins = User.where("admin=1") + admins.each do |admin| + AppliedMessage.create(:user_id => admin.id, :applied_id => organization.id, :applied_type => 'ApplySubdomain', :viewed => 0, :satus => 1, :applied_user_id => User.current.id, :name => params[:domain].downcase) + # OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase) + end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6ef1ea584..a5f92937c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2066,7 +2066,8 @@ class UsersController < ApplicationController @applied_message_alls << mess end elsif (message_all.message_type == "AppliedMessage" ) - if (mess.applied_type == "AppliedContest" && mess.status == 0) || (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) || (mess.applied_type == "AppliedProject" && mess.status == 1 && AppliedMessage.where("applied_id = #{mess.applied_id} and status != 1").count == 0) || ( mess.applied_type == "ApplyAddSchools" && ApplyAddSchools.where(:school_id => mess.applied_id, :status => 0).count != 0 ) + if (mess.applied_type == "AppliedContest" && mess.status == 0) || (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) || + (mess.applied_type == "AppliedProject" && mess.status == 1 && AppliedMessage.where("applied_id = #{mess.applied_id} and status != 1").count == 0) || ( mess.applied_type == "ApplyAddSchools" && mess.status ==0 ) @applied_message_alls << mess end elsif message_all.message_type == "CourseMessage" diff --git a/app/views/organizations/_applied_organization_domain_tip.html.erb b/app/views/organizations/_applied_organization_domain_tip.html.erb new file mode 100644 index 000000000..d2b0e0770 --- /dev/null +++ b/app/views/organizations/_applied_organization_domain_tip.html.erb @@ -0,0 +1,21 @@ +
+
+

温馨提示

+ +
+
+
+
    +
  • + <% if @flag %> +

    当前组织已申请过该域名,请耐心等待管理员的审批,审批完成后系统会以消息的形式通知您

    + <% else %> +

    您的申请已提交,系统会以消息的形式通知您结果

    + <% end %> +
  • +
  • + 知道了 +
  • +
+
+
\ No newline at end of file diff --git a/app/views/organizations/apply_subdomain.js.erb b/app/views/organizations/apply_subdomain.js.erb index e69de29bb..5fba79fd2 100644 --- a/app/views/organizations/apply_subdomain.js.erb +++ b/app/views/organizations/apply_subdomain.js.erb @@ -0,0 +1,2 @@ +var htmlvalue = "<%= escape_javascript(render :partial => 'organizations/applied_organization_domain_tip') %>"; +pop_box_new(htmlvalue,380,250); diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 1f5a81872..5e5133c07 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -227,9 +227,6 @@ data:{ id:id, domain:domain - }, - success:function(){ - $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); } }); } From 55d16eb589b547554d3e8cd497a1dd6b4361ab59 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 17 Jan 2017 13:22:03 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E7=94=B3=E8=AF=B7=E6=B6=88=E6=81=AF=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 66 +++++++++++++++---- app/helpers/application_helper.rb | 4 ++ app/helpers/users_helper.rb | 4 -- app/models/organization.rb | 1 + .../_applied_organization_domain_tip.html.erb | 4 +- .../_organization_message_ajax_tip.html.erb | 5 ++ .../agree_apply_subdomain.js.erb | 2 +- .../refused_apply_subdomain.js.erb | 1 + .../_applied_organization_sundomain.html.erb | 16 +++++ .../users/_user_message_applied.html.erb | 4 ++ ...ssage_organization_applied_action.html.erb | 11 ++++ config/routes.rb | 1 + 12 files changed, 101 insertions(+), 18 deletions(-) create mode 100644 app/views/organizations/_organization_message_ajax_tip.html.erb create mode 100644 app/views/organizations/refused_apply_subdomain.js.erb create mode 100644 app/views/users/_applied_organization_sundomain.html.erb create mode 100644 app/views/users/_user_message_organization_applied_action.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index a6a1334a9..14151cc1f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -636,31 +636,73 @@ class OrganizationsController < ApplicationController end def apply_subdomain organization = Organization.find(params[:id]) - @applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase).count + @applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase, :status => 1).count # 如果申请过该名字,怎不能重复申请 if @applied_message_count > 0 - @flag = true - return + @flag = 1 else admins = User.where("admin=1") admins.each do |admin| - AppliedMessage.create(:user_id => admin.id, :applied_id => organization.id, :applied_type => 'ApplySubdomain', :viewed => 0, :satus => 1, :applied_user_id => User.current.id, :name => params[:domain].downcase) + AppliedMessage.create(:user_id => admin.id, :applied_id => organization.id, :applied_type => 'Organization', :viewed => 0, :satus => 1, :applied_user_id => User.current.id, :name => params[:domain].downcase) # OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase) end end end + # stauts: 0:申请 ,2:申请人收到已接受消息 + # @flag 1:申请同名提醒, 2:操作的时候已经被人提前处理了 def agree_apply_subdomain - @organization = Organization.find(params[:organization_id]) - OrgMessage.find(params[:act_id]).update_attribute(:viewed, 1) - if Secdomain.where("pid=? and sub_type=2",@organization.id).count > 0 - domain = Secdomain.where("pid=? and sub_type=2",params[:organization_id]).first - Secdomain.update(domain.id, :subname => params[:org_domain]) + organization_id = params[:organization_id] + org_domain = params[:org_domain] + @applied_message = AppliedMessage.find(params[:ma_id]) + # 处理的时候判断是否有人已经处理了 + if @applied_message.status == 0 + # 事务处理:消息和数据的创建应该是同步的 + ActiveRecord::Base.transaction do + applied_messages = AppliedMessage.where(:applied_type => "Organization", :applied_id => organization_id, :name => org_domain, :status => 0) + applied_messages.update_all(:status => 2, :viewed => true, :updated_at => Time.now) + secdomain = Secdomain.where(:pid => organization_id, :sub_type => 2) + if secdomain.count > 0 + domain = Secdomain.where("pid=? and sub_type=2",organization_id).first + Secdomain.update(domain.id, :subname => params[:org_domain]) + else + Secdomain.create(:sub_type => 2, :pid => organization_id, :subname => params[:org_domain]) + end + # 自己处理自己的消息则不需要另外发送消息 + if User.current.id != @applied_message.applied_user_id + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_id => organization_id, :applied_type => 'Organization', :viewed => 0, :satus => 2, :applied_user_id => User.current.id, :name => org_domain.downcase) + end + @applied_message.status = 2 + @applied_message.updated_at = Time.now + end else - Secdomain.create(:sub_type => 2, :pid => params[:organization_id], :subname => params[:org_domain]) + @flag = 2 end - if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0 - OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain]) + end + + # stauts: 0:申请 ,2:申请人收到已接受消息, 4:已拒绝 + # @flag 1:申请同名提醒, 2:操作的时候已经被人提前处理了 + def refused_apply_subdomain + organization_id = params[:organization_id] + org_domain = params[:org_domain] + @applied_message = AppliedMessage.find(params[:ma_id]) + # 多人同时操作处理 + secdomain = Secdomain.where(:pid => organization_id, :sub_type => 2) + # 处理过程中,如果已经被其他管理员处理,则弹框提示 + if @applied_message.status == 0 + # 事务处理:消息和数据的创建应该是同步的 + ActiveRecord::Base.transaction do + applied_messages = AppliedMessage.where(:applied_type => "Organization", :applied_id => organization_id, :name => org_domain, :status => 0) + applied_messages.update_all(:status => 4, :viewed => true, :updated_at => Time.now) + # 自己处理自己的消息则不需要另外发送消息 + if User.current.id != @applied_message.applied_user_id + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_id => organization_id, :applied_type => 'Organization', :viewed => 0, :satus => 4, :applied_user_id => User.current.id, :name => org_domain.downcase) + end + @applied_message.status = 4 + @applied_message.updated_at = Time.now + end + else + @flag = 2 end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 21a3dfff8..75daaed95 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -46,6 +46,10 @@ module ApplicationHelper @objs = paginateHelper @attachments,25 end + # 判断当前用户能否对消息进行操作 + def allow_to_show applied_message + (User.current.id == applied_message.user_id && applied_message.status == 0) ? true : false + end # 获取竞赛的管理人员 def contest_managers contest diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index a2ccab87e..b9f79609b 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -134,10 +134,6 @@ module UsersHelper end end - # 判断当前用户能否对消息进行操作 - def allow_to_show applied_message - (User.current.id == applied_message.user_id && applied_message.status == 0) ? true : false - end # 项目申请消息通过状态判断用户 # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息) diff --git a/app/models/organization.rb b/app/models/organization.rb index 284754c03..864c0b8a8 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -10,6 +10,7 @@ class Organization < ActiveRecord::Base has_many :users, :through => :org_members has_many :files has_many :org_messages, :class_name => 'OrgMessage', :dependent => :destroy + has_many :applied_messages, :class_name => 'AppliedMessage', :dependent => :destroy acts_as_attachable validates_uniqueness_of :name after_create :save_as_org_activity, :add_default_subfields diff --git a/app/views/organizations/_applied_organization_domain_tip.html.erb b/app/views/organizations/_applied_organization_domain_tip.html.erb index d2b0e0770..b6b324e2c 100644 --- a/app/views/organizations/_applied_organization_domain_tip.html.erb +++ b/app/views/organizations/_applied_organization_domain_tip.html.erb @@ -7,8 +7,10 @@
  • - <% if @flag %> + <% if @flag == 1 %>

    当前组织已申请过该域名,请耐心等待管理员的审批,审批完成后系统会以消息的形式通知您

    + <% elsif @flag == 2 %> +

    已经被其他管理员抢先一步处理了

    <% else %>

    您的申请已提交,系统会以消息的形式通知您结果

    <% end %> diff --git a/app/views/organizations/_organization_message_ajax_tip.html.erb b/app/views/organizations/_organization_message_ajax_tip.html.erb new file mode 100644 index 000000000..f39514ca3 --- /dev/null +++ b/app/views/organizations/_organization_message_ajax_tip.html.erb @@ -0,0 +1,5 @@ +<% if @flag == 2 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'organizations/applied_organization_domain_tip') %>"; + pop_box_new(htmlvalue,380,250); +<% end %> +$("#applied_project_<%= @applied_message.id %>").html('<%= escape_javascript( render :partial => 'users/applied_organization_sundomain', :locals => {:ma => @applied_message}) %>'); \ No newline at end of file diff --git a/app/views/organizations/agree_apply_subdomain.js.erb b/app/views/organizations/agree_apply_subdomain.js.erb index 314d48e15..71398b9fc 100644 --- a/app/views/organizations/agree_apply_subdomain.js.erb +++ b/app/views/organizations/agree_apply_subdomain.js.erb @@ -1 +1 @@ -$("#agree_apply_subdomain_<%= params[:act_id] %>").text("已同意申请"); \ No newline at end of file +<%= render "organizations/organization_message_ajax_tip" %> \ No newline at end of file diff --git a/app/views/organizations/refused_apply_subdomain.js.erb b/app/views/organizations/refused_apply_subdomain.js.erb new file mode 100644 index 000000000..71398b9fc --- /dev/null +++ b/app/views/organizations/refused_apply_subdomain.js.erb @@ -0,0 +1 @@ +<%= render "organizations/organization_message_ajax_tip" %> \ No newline at end of file diff --git a/app/views/users/_applied_organization_sundomain.html.erb b/app/views/users/_applied_organization_sundomain.html.erb new file mode 100644 index 000000000..75dfb43bb --- /dev/null +++ b/app/views/users/_applied_organization_sundomain.html.erb @@ -0,0 +1,16 @@ +
    +
  • + <%=link_to image_tag(url_to_avatar(ma.applied), :width => "30", :height => "30"), organization_path(ma.applied_id), :target => '_blank' %> +
  • +
  • + <%=link_to ma.applied.name, organization_path(ma.applied_id), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + 申请子域名: +
  • +
  • + <%= ma.name %> +
  • +
+
  • + <%= render :partial => "users/user_message_organization_applied_action", :locals => {:ma => ma} %> +
  • +
  • <%= time_tag(ma.updated_at).html_safe %>
  • diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index edfa43692..babf72099 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -25,6 +25,10 @@
      <%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %>
    +<% elsif ma && ma.applied_type == "Organization" %> +
      + <%= render :partial => "users/applied_organization_sundomain", :locals =>{:ma => ma} %> +
    <% elsif ma && ma.applied_type == "StudentWorksScoresAppeal" %>
      diff --git a/app/views/users/_user_message_organization_applied_action.html.erb b/app/views/users/_user_message_organization_applied_action.html.erb new file mode 100644 index 000000000..ff069ee62 --- /dev/null +++ b/app/views/users/_user_message_organization_applied_action.html.erb @@ -0,0 +1,11 @@ +<% ma = ma.nil? ? local_assigns[:ma] : ma %> +<% if allow_to_show(ma) %> + <%= link_to "同意", agree_apply_subdomain_organizations_path(:organization_id => ma.applied_id, :org_domain => ma.name, :user_id => ma.applied_user_id, :ma_id => ma.id), + :remote => true, :method => :post, :class => "link-blue", :style => "font-size: 14px;" %> | + <%= link_to "拒绝", refused_apply_subdomain_organizations_path(:organization_id => ma.applied_id, :org_domain => ma.name, :user_id => ma.applied_user_id, :ma_id => ma.id), + :remote => true, :method => :post, :class => "link-blue",:style => "font-size: 14px;" %> +<% elsif ma.status == 2 %> + 已同意 +<% elsif ma.status == 4 %> + 已拒绝 +<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e8f2c1c18..35b57b468 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -103,6 +103,7 @@ RedmineApp::Application.routes.draw do post 'reset_excellent_teacher' post 'reset_excellent_student' post 'agree_apply_subdomain' + post 'refused_apply_subdomain' post 'update_field_by_admin' post 'reset_update_field_by_admin' end From 9734c46b2fc74c122142216dce5df45fc3f00315 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 17 Jan 2017 16:21:32 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=B1=BB=E6=B6=88=E6=81=AF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96=EF=BC=8C=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E7=B1=BB=E6=B6=88=E6=81=AF=E6=96=B9=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 72 +++++------------------------ app/models/message_all.rb | 9 ++++ app/models/org_message.rb | 2 +- 3 files changed, 22 insertions(+), 61 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a5f92937c..9aead860d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2054,43 +2054,10 @@ class UsersController < ApplicationController # @unreview_homework = 1 # 待审批的申请 - @applied_message_alls = [] - OrgMessage - - applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message) - applied_messages_all.each do |message_all| - mess = message_all.message - if !mess.nil? - if (message_all.message_type == "OrgMessage") - if mess.message_type == "ApplySubdomain" && OrgMessage.where(:organization_id => mess.organization_id, :message_type => "AgreeApplySubdomain").count == 0 - @applied_message_alls << mess - end - elsif (message_all.message_type == "AppliedMessage" ) - if (mess.applied_type == "AppliedContest" && mess.status == 0) || (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) || - (mess.applied_type == "AppliedProject" && mess.status == 1 && AppliedMessage.where("applied_id = #{mess.applied_id} and status != 1").count == 0) || ( mess.applied_type == "ApplyAddSchools" && mess.status ==0 ) - @applied_message_alls << mess - end - elsif message_all.message_type == "CourseMessage" - if mess.course_message_type == "JoinCourseRequest" && mess.status == 0 - @applied_message_alls << mess - end - elsif message_all.message_type == "ForgeMessage" - if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0 && PullRequest.where(:pull_request_id => mess.forge_message_id).first.user_id != User.current.id - user_id = PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).first.id - if ForgeMessage.where("status in (1,3) and user_id != #{user_id} and pull_request_id = #{mess.forge_message_id}") - @applied_message_alls << mess - end - end - end - end - end - @applied_message_alls_count = @applied_message_alls.count - # org_applied_messages = MessageAll.where(:message_type => "OrgMessage").includes(:message).order("created_at desc") - # org_applied_messages = org_applied_messages.message.map{|message| message.message_type == "ApplySubdomain" and OrgMessage.where(:organization_id => message.organization_id, :message_type => "AgreeApplySubdomain").count == 0}.length - # project_message_applied_count = AppliedMessage.where(:user_id => @user.id, :message_type => "AppliedProject", :status => 1) - # school_message_applied_count = AppliedMessage.where(:user_id => @user.id, :message_type => "ApplyAddSchools", :status => 0) - # course_message_applied_count = CourseMessage.where(:message_type => "JoinCourse", :satus => 0) - # @applied_message_count = org_message_applied_count + project_message_applied_count + school_message_applied_count + course_message_applied_count + applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count + applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count + applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count + @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count else # 看别人的主页显示动态 #更新用户申请成为课程老师或教辅消息的状态 @@ -2273,33 +2240,18 @@ class UsersController < ApplicationController end # 待审批的申请 + # 待审批的消息一般不多,可以特殊处理 def unapproval_applied_list @message_alls = [] - # messages_all = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc") - messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message).order("created_at desc") + messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message).where("message.status =?", 0).order("created_at desc") messages_all.each do |message_all| mess = message_all.message - if !mess.nil? - if (message_all.message_type == "OrgMessage") - if mess.message_type == "ApplySubdomain" && OrgMessage.where(:organization_id => mess.organization_id, :message_type => "AgreeApplySubdomain").count == 0 - @message_alls << mess - end - elsif (message_all.message_type == "AppliedMessage" ) - if (mess.applied_type == "AppliedContest" && mess.status == 0) || (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) || (mess.applied_type == "AppliedProject" && mess.status == 1 && AppliedMessage.where("applied_id = #{mess.applied_id} and status != 1").count == 0) || ( mess.applied_type == "ApplyAddSchools" && ApplyAddSchools.where(:school_id => mess.applied_id, :status => 0).count != 0 ) - @message_alls << mess - end - elsif message_all.message_type == "CourseMessage" - if mess.course_message_type == "JoinCourseRequest" && mess.status == 0 - @message_alls << mess - end - elsif message_all.message_type == "ForgeMessage" - if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0 && PullRequest.where(:pull_request_id => mess.forge_message_id).first.user_id != User.current.id - user_id = PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).first.id - if ForgeMessage.where("status in (1,3) and user_id != #{user_id} and pull_request_id = #{mess.forge_message_id}") - @message_alls << mess - end - end - end + if message_all.message_type == "CourseMessage" && mess && mess.try(:course_message_type) == "JoinCourseRequest" && mess.try(:status) == 0 + @message_alls << mess + elsif message_all.message_type == "AppliedMessage" && mess && mess.try(:status) == 0 && (["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"].include? mess.try(:applied_type)) + @message_alls << mess + elsif message_all.message_type == "ForgeMessage" && message_all.message && message_all.message.try(:forge_message_type) == "PullRequest" && (message_all.message.try(:status) == 1 || message_all.message.try(:status) == 3) + @message_alls << mess end end @message_count = @message_alls.count diff --git a/app/models/message_all.rb b/app/models/message_all.rb index 836d24b9f..c84579ceb 100644 --- a/app/models/message_all.rb +++ b/app/models/message_all.rb @@ -2,5 +2,14 @@ class MessageAll < ActiveRecord::Base attr_accessible :message_id, :message_type, :user_id belongs_to :user # 虚拟关联---项目消息表/课程消息表/用户留言消息表/贴吧消息表 + belongs_to :forge_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'ForgeMessage'" + belongs_to :course_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'CourseMessage'" + belongs_to :applied_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'AppliedMessage'" + belongs_to :at_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'AtMessage'" + belongs_to :memo_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'MemoMessage'" + belongs_to :org_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'OrgMessage'" + belongs_to :system_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'SystemMessage'" + belongs_to :user_feedback_message, foreign_key: 'message_id', conditions: "message_alls.message_type = 'UserFeedbackMessage'" belongs_to :message ,:polymorphic => true + end diff --git a/app/models/org_message.rb b/app/models/org_message.rb index baedc77f4..35f00962f 100644 --- a/app/models/org_message.rb +++ b/app/models/org_message.rb @@ -1,7 +1,7 @@ class OrgMessage < ActiveRecord::Base belongs_to :user belongs_to :organization - has_many :message_alls, :as => :message, :dependent => :destroy + has_many :message_alls, :class_name => 'MessageAll', :as => :message, :dependent => :destroy validates :message_type, :presence => true validates :message_id, :presence => true validates :organization_id, :presence => true From 11c5b0ab41265515853193269bba6524bcd3843a Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 18 Jan 2017 14:14:44 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=B1=BB=E6=B6=88=E6=81=AF=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E6=80=A7=E8=83=BD=E6=8F=90=E5=8D=871s=E5=A4=9A?= =?UTF-8?q?=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=97=B6=E9=97=B422ms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9aead860d..96f159165 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2242,18 +2242,13 @@ class UsersController < ApplicationController # 待审批的申请 # 待审批的消息一般不多,可以特殊处理 def unapproval_applied_list - @message_alls = [] - messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message).where("message.status =?", 0).order("created_at desc") - messages_all.each do |message_all| - mess = message_all.message - if message_all.message_type == "CourseMessage" && mess && mess.try(:course_message_type) == "JoinCourseRequest" && mess.try(:status) == 0 - @message_alls << mess - elsif message_all.message_type == "AppliedMessage" && mess && mess.try(:status) == 0 && (["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"].include? mess.try(:applied_type)) - @message_alls << mess - elsif message_all.message_type == "ForgeMessage" && message_all.message && message_all.message.try(:forge_message_type) == "PullRequest" && (message_all.message.try(:status) == 1 || message_all.message.try(:status) == 3) - @message_alls << mess - end - end + user_id = User.current.id + sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id + left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id + where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or + (ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or + (ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );" + @message_alls = MessageAll.find_by_sql(sql) @message_count = @message_alls.count @message_alls = paginateHelper @message_alls, 20 respond_to do |format| From fc35fe5e48485db5a3c80b015f9df1431e683a73 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 18 Jan 2017 15:01:40 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=B7=BB=E5=8A=A0=E5=BD=93=E5=89=8D=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/changes.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/repositories/changes.html.erb b/app/views/repositories/changes.html.erb index 20b77f666..0c5a4bae3 100644 --- a/app/views/repositories/changes.html.erb +++ b/app/views/repositories/changes.html.erb @@ -8,7 +8,7 @@

      <%= day %>

      -

      <%= commits.count %>个提交

      +

      当前页<%= commits.count %>个提交

        <% commits.each do |commit| %> From e1f107bf4fb22a757132a45981f6793b5614da1d Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 19 Jan 2017 15:51:53 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=A3=80=E7=B4=A2=E9=85=8D=E7=BD=AE=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/views/admin/syllabuses.html.erb | 5 +++++ app/views/layouts/base_courses.html.erb | 4 +++- db/migrate/20170119072629_add_os_allow_to_course.rb | 5 +++++ db/schema.rb | 3 ++- public/stylesheets/css/public.css | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20170119072629_add_os_allow_to_course.rb diff --git a/app/views/admin/syllabuses.html.erb b/app/views/admin/syllabuses.html.erb index d24f7d39a..c255c3c2c 100644 --- a/app/views/admin/syllabuses.html.erb +++ b/app/views/admin/syllabuses.html.erb @@ -38,6 +38,9 @@ <%=l(:field_created_on)%> + + 开源检索 + @@ -57,6 +60,7 @@ <%= format_date(syllabus.created_at) %> + <% courses = syllabus.courses.not_deleted %> <% courses.each do |course| %> @@ -75,6 +79,7 @@ <%= format_date(course.created_at) %> + <%= course.try(:os_allow) == 0 ? 不允许 : 允许 %> <% end %> <% end %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index a437ea01f..164c5cf64 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -147,7 +147,9 @@ <%# 课程英雄榜 %> <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
        -

        推荐

        +

        推荐 + 开源检索 +

        <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
        <%# 更新访问数,刷新的时候更新访问次数 %> diff --git a/db/migrate/20170119072629_add_os_allow_to_course.rb b/db/migrate/20170119072629_add_os_allow_to_course.rb new file mode 100644 index 000000000..461e5ab4c --- /dev/null +++ b/db/migrate/20170119072629_add_os_allow_to_course.rb @@ -0,0 +1,5 @@ +class AddOsAllowToCourse < ActiveRecord::Migration + def change + add_column :courses, :os_allow, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 09866ad15..2498fb3af 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20170112082231) do +ActiveRecord::Schema.define(:version => 20170119072629) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -731,6 +731,7 @@ ActiveRecord::Schema.define(:version => 20170112082231) do t.integer "qrcode_expiretime", :default => 0 t.integer "professional_level_id", :limit => 1 t.integer "invite_code_halt", :limit => 1, :default => 0 + t.integer "os_allow", :default => 0 end add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index ff203e977..52298db25 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -415,6 +415,7 @@ a.sortArrowActiveD {background:url(../images/post_image_list.png) -0px -20px no- a.sortArrowActiveU {background:url(../images/post_image_list.png) -17px -20px no-repeat; width:7px; height:9px; float:left; margin-left:5px; margin-top:5px;} .creatPost {width:80px; height:25px; border-radius:3px; color:#ffffff; text-align:center; float:right; line-height:25px; vertical-align:middle; margin-top:2px;} .creatPostIcon {background:url(../images/post_image_list.png) -40px -54px no-repeat; width:70px; height:25px; padding-left:10px; border-radius:3px;} +.creatPostIcon2 {width:60px; height:20px; padding-left:10px; border-radius:3px;} .postRow {width:970px; border-bottom:1px solid #efefef; padding:15px 0;} .postPortrait {width:75px; height:75px; float:left; margin-right:15px;} .postWrap {width:690px; float:left; margin-right:95px;}