Merge branch 'dev_tieba' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
daiao 2017-01-19 15:57:55 +08:00
commit a2aea42868
25 changed files with 215 additions and 146 deletions

View File

@ -58,7 +58,7 @@ class MembersController < ApplicationController
applied_project = @applied_message.applied applied_project = @applied_message.applied
user = User.find(@applied_message.applied_user_id) user = User.find(@applied_message.applied_user_id)
project = Project.find(applied_project.project_id) if !applied_project.nil? 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 = "该申请已被其他管理员处理" @flash_message = "该申请已被其他管理员处理"
# @applied_message.update_attribute(:status, 2) # @applied_message.update_attribute(:status, 2)
else else
@ -77,7 +77,7 @@ class MembersController < ApplicationController
project.user_grades << user_grades unless user_grades.first.user_id.nil? 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_type => "AppliedProject")
applied_messages.update_all(:status => 7, :viewed => true) applied_messages.update_all(:status => 7, :viewed => true)
@applied_message = AppliedMessage.find(params[:applied_message_id]) @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 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 , # 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 rescue Exception => e
puts e puts e
end end
@ -106,7 +106,7 @@ class MembersController < ApplicationController
applied_project = @applied_message.applied applied_project = @applied_message.applied
project = Project.find(@applied_message.project_id) if !applied_project.nil? project = Project.find(@applied_message.project_id) if !applied_project.nil?
user = User.find(@applied_message.applied_user_id) 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 = "该申请已被其他管理员处理" @flash_message = "该申请已被其他管理员处理"
# @applied_message.update_attribute(:status, 2) # @applied_message.update_attribute(:status, 2)
else 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) :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_type => "AppliedProject")
applied_messages.update_all(:status => 5, :viewed => true) applied_messages.update_all(:status => 5, :viewed => true)
@applied_message = AppliedMessage.find(params[:applied_message_id]) @applied_message = AppliedMessage.find(params[:applied_message_id])

View File

@ -635,24 +635,74 @@ class OrganizationsController < ApplicationController
end end
end end
def apply_subdomain def apply_subdomain
@organization = Organization.find(params[:id]) organization = Organization.find(params[:id])
admins = User.where("admin=1") @applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase, :status => 1).count
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) if @applied_message_count > 0
@flag = 1
else
admins = User.where("admin=1")
admins.each do |admin|
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
end end
# stauts: 0申请 2申请人收到已接受消息
# @flag 1申请同名提醒 2操作的时候已经被人提前处理了
def agree_apply_subdomain def agree_apply_subdomain
@organization = Organization.find(params[:organization_id]) organization_id = params[:organization_id]
OrgMessage.find(params[:act_id]).update_attribute(:viewed, 1) org_domain = params[:org_domain]
if Secdomain.where("pid=? and sub_type=2",@organization.id).count > 0 @applied_message = AppliedMessage.find(params[:ma_id])
domain = Secdomain.where("pid=? and sub_type=2",params[:organization_id]).first # 处理的时候判断是否有人已经处理了
Secdomain.update(domain.id, :subname => params[:org_domain]) 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 else
Secdomain.create(:sub_type => 2, :pid => params[:organization_id], :subname => params[:org_domain]) @flag = 2
end end
if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0 end
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])
# 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 end
end end

View File

@ -2052,42 +2052,10 @@ class UsersController < ApplicationController
# @unreview_homework = 1 # @unreview_homework = 1
# 待审批的申请 # 待审批的申请
@applied_message_alls = [] applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count
OrgMessage 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_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message) @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count
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" && ApplyAddSchools.where(:school_id => mess.applied_id, :status => 0).count != 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
else else
# 看别人的主页显示动态 # 看别人的主页显示动态
#更新用户申请成为课程老师或教辅消息的状态 #更新用户申请成为课程老师或教辅消息的状态
@ -2270,35 +2238,15 @@ class UsersController < ApplicationController
end end
# 待审批的申请 # 待审批的申请
# 待审批的消息一般不多,可以特殊处理
def unapproval_applied_list def unapproval_applied_list
@message_alls = [] user_id = User.current.id
# messages_all = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc") sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message).order("created_at desc") left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
messages_all.each do |message_all| 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
mess = message_all.message (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
if !mess.nil? (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} );"
if (message_all.message_type == "OrgMessage") @message_alls = MessageAll.find_by_sql(sql)
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
end
end
@message_count = @message_alls.count @message_count = @message_alls.count
@message_alls = paginateHelper @message_alls, 20 @message_alls = paginateHelper @message_alls, 20
respond_to do |format| respond_to do |format|

View File

@ -46,6 +46,10 @@ module ApplicationHelper
@objs = paginateHelper @attachments,25 @objs = paginateHelper @attachments,25
end 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 def contest_managers contest

View File

@ -134,10 +134,6 @@ module UsersHelper
end end
end end
# 判断当前用户能否对消息进行操作
def allow_to_show applied_message
(User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false
end
# 项目申请消息通过状态判断用户 # 项目申请消息通过状态判断用户
# status(1申请的消息2已操作过该消息包括同意或者拒绝消息状态更新3拒绝消息4:被拒人收到消息5拒绝者收到消息6同意后申请人收到消息7同意后批准人收到消息) # status(1申请的消息2已操作过该消息包括同意或者拒绝消息状态更新3拒绝消息4:被拒人收到消息5拒绝者收到消息6同意后申请人收到消息7同意后批准人收到消息)

View File

@ -11,7 +11,7 @@ class AppliedProject < ActiveRecord::Base
# 仅仅给项目管理人员发送消息 # 仅仅给项目管理人员发送消息
def send_appliled_message def send_appliled_message
self.project.managers.each do |member| 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 count = ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count

View File

@ -2,5 +2,14 @@ class MessageAll < ActiveRecord::Base
attr_accessible :message_id, :message_type, :user_id attr_accessible :message_id, :message_type, :user_id
belongs_to :user 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 belongs_to :message ,:polymorphic => true
end end

View File

@ -1,7 +1,7 @@
class OrgMessage < ActiveRecord::Base class OrgMessage < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :organization 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_type, :presence => true
validates :message_id, :presence => true validates :message_id, :presence => true
validates :organization_id, :presence => true validates :organization_id, :presence => true

View File

@ -10,6 +10,7 @@ class Organization < ActiveRecord::Base
has_many :users, :through => :org_members has_many :users, :through => :org_members
has_many :files has_many :files
has_many :org_messages, :class_name => 'OrgMessage', :dependent => :destroy has_many :org_messages, :class_name => 'OrgMessage', :dependent => :destroy
has_many :applied_messages, :class_name => 'AppliedMessage', :dependent => :destroy
acts_as_attachable acts_as_attachable
validates_uniqueness_of :name validates_uniqueness_of :name
after_create :save_as_org_activity, :add_default_subfields after_create :save_as_org_activity, :add_default_subfields

View File

@ -38,6 +38,9 @@
<th style="width: 60px;"> <th style="width: 60px;">
<%=l(:field_created_on)%> <%=l(:field_created_on)%>
</th> </th>
<th style="width: 30px;">
开源检索
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -57,6 +60,7 @@
<td class="center"> <td class="center">
<%= format_date(syllabus.created_at) %> <%= format_date(syllabus.created_at) %>
</td> </td>
<td></td>
</tr> </tr>
<% courses = syllabus.courses.not_deleted %> <% courses = syllabus.courses.not_deleted %>
<% courses.each do |course| %> <% courses.each do |course| %>
@ -75,6 +79,7 @@
<td class="center"> <td class="center">
<%= format_date(course.created_at) %> <%= format_date(course.created_at) %>
</td> </td>
<td style="text-align: center;"><a><%= course.try(:os_allow) == 0 ? 不允许 : 允许 %></a></td>
</tr> </tr>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -147,7 +147,9 @@
<%# 课程英雄榜 %> <%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %> <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<div class="sy_class_leftbox" > <div class="sy_class_leftbox" >
<h3 class="fontGrey7">推荐</h3> <h3 class="fontGrey7"><span>推荐</span>
<a class="c_white db creatPostIcon2 bGreen fr" href="http://ossean.trustie.net?user_id=<%= User.current.id %>" target="_blank">开源检索</a>
</h3>
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
</div> </div>
<%# 更新访问数,刷新的时候更新访问次数 %> <%# 更新访问数,刷新的时候更新访问次数 %>

View File

@ -0,0 +1,23 @@
<div id="sy_popup_box" style="width:380px;">
<div class="sy_popup_top sy_popup_top_tishi">
<h3 class="fl">温馨提示</h3>
<a href="javascript:void(0);" class="sy_icons_close02 fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con02" >
<ul class="sy_popup_tishi ">
<li>
<% if @flag == 1 %>
<p>当前组织已申请过该域名,请耐心等待管理员的审批,审批完成后系统会以消息的形式通知您</p>
<% elsif @flag == 2 %>
<p>已经被其他管理员抢先一步处理了</p>
<% else %>
<p>您的申请已提交,系统会以消息的形式通知您结果</p>
<% end %>
</li>
<li>
<a href="javascript:void(0);" class="sy_btn_blue " onclick="hideModal()">知道了</a>
</li>
</ul>
</div>
</div>

View File

@ -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}) %>');

View File

@ -1 +1 @@
$("#agree_apply_subdomain_<%= params[:act_id] %>").text("已同意申请"); <%= render "organizations/organization_message_ajax_tip" %>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'organizations/applied_organization_domain_tip') %>";
pop_box_new(htmlvalue,380,250);

View File

@ -0,0 +1 @@
<%= render "organizations/organization_message_ajax_tip" %>

View File

@ -227,9 +227,6 @@
data:{ data:{
id:id, id:id,
domain:domain domain:domain
},
success:function(){
$("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果");
} }
}); });
} }

View File

@ -8,7 +8,7 @@
<div class="pullreques_pullbox"> <div class="pullreques_pullbox">
<div class="pullreques_pull_top clear"> <div class="pullreques_pull_top clear">
<p class="fl c_grey ml15"><%= day %></p> <p class="fl c_grey ml15"><%= day %></p>
<p class="fr c_green mr15"><%= commits.count %>个提交</p> <p class="fr c_green mr15">当前页<%= commits.count %>个提交</p>
</div> </div>
<ul class="pullreques_pull_list"> <ul class="pullreques_pull_list">
<% commits.each do |commit| %> <% commits.each do |commit| %>

View File

@ -0,0 +1,16 @@
<div class="shortMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(ma.applied), :width => "30", :height => "30"), organization_path(ma.applied_id), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.applied.name, organization_path(ma.applied_id), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class='homepageNewsType fl'>申请子域名:</span>
</li>
<li class="messageInformationContents">
<%= ma.name %>
</li>
</div>
<li class="messageOperateContents fl">
<span><%= render :partial => "users/user_message_organization_applied_action", :locals => {:ma => ma} %></span>
</li>
<li class="homepageNewsTime fr"><%= time_tag(ma.updated_at).html_safe %> </li>

View File

@ -25,6 +25,10 @@
<ul class="homepageNewsList fl" id="applied_project_<%= ma.id %>"> <ul class="homepageNewsList fl" id="applied_project_<%= ma.id %>">
<%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %> <%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %>
</ul> </ul>
<% elsif ma && ma.applied_type == "Organization" %>
<ul class="homepageNewsList fl" id="applied_project_<%= ma.id %>">
<%= render :partial => "users/applied_organization_sundomain", :locals =>{:ma => ma} %>
</ul>
<!-- 匿评成绩申诉 --> <!-- 匿评成绩申诉 -->
<% elsif ma && ma.applied_type == "StudentWorksScoresAppeal" %> <% elsif ma && ma.applied_type == "StudentWorksScoresAppeal" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">

View File

@ -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 %>
<span style="font-size:14px;">已同意</span>
<% elsif ma.status == 4 %>
<span style="font-size:14px;">已拒绝</span>
<% end %>

View File

@ -103,6 +103,7 @@ RedmineApp::Application.routes.draw do
post 'reset_excellent_teacher' post 'reset_excellent_teacher'
post 'reset_excellent_student' post 'reset_excellent_student'
post 'agree_apply_subdomain' post 'agree_apply_subdomain'
post 'refused_apply_subdomain'
post 'update_field_by_admin' post 'update_field_by_admin'
post 'reset_update_field_by_admin' post 'reset_update_field_by_admin'
end end

View File

@ -0,0 +1,5 @@
class AddOsAllowToCourse < ActiveRecord::Migration
def change
add_column :courses, :os_allow, :integer, :default => 0
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20170111030006) do ActiveRecord::Schema.define(:version => 20170119072629) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -698,8 +698,8 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.string "code" t.string "code"
t.integer "time" t.integer "time"
t.string "extra" t.string "extra"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "location" t.string "location"
t.string "term" t.string "term"
t.string "string" t.string "string"
@ -709,27 +709,29 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.string "class_period" t.string "class_period"
t.integer "school_id" t.integer "school_id"
t.text "description" t.text "description"
t.integer "status", :default => 1 t.integer "status", :default => 1
t.integer "attachmenttype", :default => 2 t.integer "attachmenttype", :default => 2
t.integer "lft" t.integer "lft"
t.integer "rgt" t.integer "rgt"
t.integer "is_public", :limit => 1, :default => 1 t.integer "is_public", :limit => 1, :default => 1
t.integer "inherit_members", :limit => 1, :default => 1 t.integer "inherit_members", :limit => 1, :default => 1
t.integer "open_student", :default => 0 t.integer "open_student", :default => 0
t.integer "outline", :default => 0 t.integer "outline", :default => 0
t.integer "publish_resource", :default => 0 t.integer "publish_resource", :default => 0
t.integer "is_delete", :default => 0 t.integer "is_delete", :default => 0
t.integer "end_time" t.integer "end_time"
t.string "end_term" t.string "end_term"
t.integer "is_excellent", :default => 0 t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0 t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0 t.integer "is_copy", :default => 0
t.integer "visits", :default => 0 t.integer "visits", :default => 0
t.integer "syllabus_id" t.integer "syllabus_id"
t.string "invite_code" t.string "invite_code"
t.string "qrcode" t.string "qrcode"
t.integer "qrcode_expiretime", :default => 0 t.integer "qrcode_expiretime", :default => 0
t.integer "invite_code_halt", :limit => 1, :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 end
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
@ -804,19 +806,9 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "delayed_jobs_20161218", :id => false, :force => true do |t| create_table "disciplines", :force => true do |t|
t.integer "id", :default => 0, :null => false t.string "name"
t.integer "priority", :default => 0, :null => false t.integer "professional_level_id", :limit => 1
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"
end end
create_table "discuss_demos", :force => true do |t| create_table "discuss_demos", :force => true do |t|
@ -1138,19 +1130,6 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end 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| create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a" t.integer "a"
end end
@ -1687,9 +1666,12 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
end end
create_table "professional_levels", :force => true do |t| create_table "professional_levels", :force => true do |t|
t.string "level" t.integer "level"
t.datetime "created_at", :null => false end
t.datetime "updated_at", :null => false
create_table "professions", :force => true do |t|
t.string "name"
t.integer "discipline_id", :limit => 1
end end
create_table "project_infos", :force => true do |t| create_table "project_infos", :force => true do |t|
@ -1752,7 +1734,6 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.boolean "hidden_repo", :default => false, :null => false t.boolean "hidden_repo", :default => false, :null => false
t.integer "attachmenttype", :default => 1 t.integer "attachmenttype", :default => 1
t.integer "user_id" t.integer "user_id"
t.integer "dts_test", :default => 0
t.string "enterprise_name" t.string "enterprise_name"
t.integer "organization_id" t.integer "organization_id"
t.integer "project_new_type" t.integer "project_new_type"
@ -1760,6 +1741,11 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.integer "forked_from_project_id" t.integer "forked_from_project_id"
t.integer "forked_count" t.integer "forked_count"
t.integer "publish_resource", :default => 0 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 "visits", :default => 0
t.integer "hot", :default => 0 t.integer "hot", :default => 0
t.string "invite_code" t.string "invite_code"
@ -2082,9 +2068,10 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.integer "score" t.integer "score"
t.text "comment" t.text "comment"
t.integer "reviewer_role" t.integer "reviewer_role"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "appeal_status", :default => 0 t.integer "appeal_status", :default => 0
t.boolean "is_hidden", :default => false
end end
add_index "student_works_scores", ["student_work_id"], :name => "student_work_id" add_index "student_works_scores", ["student_work_id"], :name => "student_work_id"
@ -2157,8 +2144,8 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.string "title" t.string "title"
t.text "description" t.text "description"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "eng_name" t.string "eng_name"
t.integer "syllabus_type" t.integer "syllabus_type"
t.integer "credit" t.integer "credit"
@ -2167,8 +2154,9 @@ ActiveRecord::Schema.define(:version => 20170111030006) do
t.integer "practice_hours" t.integer "practice_hours"
t.string "applicable_major" t.string "applicable_major"
t.string "pre_course" t.string "pre_course"
t.integer "visits", :default => 0 t.integer "visits", :default => 0
t.integer "des_status", :default => 0 t.integer "des_status", :default => 0
t.integer "professional_level_id", :limit => 1
end end
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"

View File

@ -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;} 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;} .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;} .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;} .postRow {width:970px; border-bottom:1px solid #efefef; padding:15px 0;}
.postPortrait {width:75px; height:75px; float:left; margin-right:15px;} .postPortrait {width:75px; height:75px; float:left; margin-right:15px;}
.postWrap {width:690px; float:left; margin-right:95px;} .postWrap {width:690px; float:left; margin-right:95px;}