Merge branch 'rep_quality' into develop

This commit is contained in:
huang 2016-09-01 12:29:51 +08:00
commit ff489fedc6
30 changed files with 321 additions and 102 deletions

View File

@ -2152,6 +2152,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids]
@hidden_unproject = hidden_unproject_infos
respond_to do |format|
format.js
end
@ -2171,6 +2172,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
@hidden_unproject = hidden_unproject_infos
respond_to do |format|
format.js
end
@ -3334,6 +3336,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids]
@hidden_unproject = hidden_unproject_infos
respond_to do |format|
format.js
end

View File

@ -837,11 +837,7 @@ module ApplicationHelper
return false if project.gpid.nil?
g = Gitlab.client
count = g.user_static(project.gpid, :rev => "master").count
if User.current.member_of?(project) && count > 0
true
else
false
end
count
end
# 判断版本库是否初始为gitlab

View File

@ -1162,18 +1162,20 @@ class User < Principal
#为新注册用户发送留言
def add_new_jour
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
lead_message1 = Message.find(19292)
notes1 = lead_message1.content
lead_message2 = Message.find(19291)
notes2 = lead_message2.content
lead_message3 = Message.find(19504)
notes3 = lead_message3.content
#user_id 默认为课程使者创建
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
end
if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
lead_message1 = Message.find(19292)
notes1 = lead_message1.content
lead_message2 = Message.find(19291)
notes2 = lead_message2.content
lead_message3 = Message.find(19504)
notes3 = lead_message3.content
#user_id 默认为课程使者创建
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
end
end
end
# 更新邮箱的同事更新invite_lists表中的邮箱信息

View File

@ -63,7 +63,11 @@
<li class="homepagePostSettingIcon">
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% if hidden_unproject_infos %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
<% if file.container.try(:organization).try(:is_public?) %>
<li>

View File

@ -4,7 +4,11 @@
<% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %>
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% if hidden_unproject_infos %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
<% if project.is_public? %>
<li>
@ -20,7 +24,11 @@
<% end %>
<% else %>
<ul class="resourceSendO">
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% if hidden_unproject_infos %>
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
</ul>
<% end %>
<% end %>

View File

@ -4,7 +4,9 @@
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<li class="fl"><%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% if hidden_unproject_infos %>
<li class="fl"><%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a></li>
</ul>

View File

@ -10,12 +10,14 @@
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">资源库</a>
</li>
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
</li>
<li class="navHomepageMenu fl mr30">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
</li>
<% if hidden_unproject_infos %>
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
</li>
<li class="navHomepageMenu fl mr30">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
</li>
<% end %>
</ul>
</div>
<div class="fl" id="navHomepageSearch">

View File

@ -152,9 +152,7 @@
</div>
<div class="user_leftnav ">
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<% if hidden_unproject_infos %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<a href ="javascript:void(0);" disabled="true">课程</a>
@ -233,7 +231,9 @@
<%= yield %>
</div>
</div>
<%= render :partial => 'layouts/forbidden_new_feedback' %>
<% if hidden_unproject_infos %>
<%= render :partial => 'layouts/forbidden_new_feedback' %>
<% end %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer_show' %>

View File

@ -116,7 +116,11 @@
) if @message.destroyable_by?(User.current) %>
</li>
<% end %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
<% if hidden_unproject_infos %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
<% else %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
<% end %>
</ul>
</li>
</ul>

View File

@ -61,19 +61,21 @@
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
</div>
<% when 'course' %>
<div style="display:<%= field.hide == 0 ? 'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">班级</a>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联班级"%>
<% end %>
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
<ul >
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
</ul>
</div>
</div>
<% if hidden_unproject_infos %>
<div style="display:<%= field.hide == 0 ? 'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">班级</a>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联班级"%>
<% end %>
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
<ul >
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
</ul>
</div>
</div>
<% end %>
<% when 'project' %>
<div style="display:<%= field.hide == 0 ? 'block':'none' %>;" id="org_subfield_<%= field.id %>">
<div class="homepageLeftMenuBlock">

View File

@ -20,6 +20,7 @@
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<% if hidden_unproject_infos %>
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
@ -33,6 +34,7 @@
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<% end %>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>

View File

@ -40,12 +40,14 @@
</div>
<% end %>
<div class="subNav">
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<% if allow_pull_request(@project) %>
<%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %>
<% end %>
</div>
<% if allow_pull_request(@project) %>
<div class="subNav">
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<% if User.current.member_of?(@project) %>
<%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %>
<% end %>
</div>
<% end %>
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% if visible_repository?(@project) %>

View File

@ -38,7 +38,12 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<% if hidden_unproject_infos %>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<% else %>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{activity.id}',#{User.current.id},'news')") %></li>
<% end %>
<li>
<%= link_to(l(:button_edit), {:controller => 'news', :action => 'edit', :id => activity}, :class => 'postOptionLink') if activity.author == User.current %>
</li>

View File

@ -3,7 +3,7 @@
<li class="active"><%= link_to "待处理<span class='project-number-dot'>#{@requests_opened_count}</span>".html_safe, project_pull_requests_path(:type => "1"), :remote => true %></li>
<li><%= link_to "已处理<span class='project-number-dot'>#{@requests_merged_count}</span>".html_safe, project_pull_requests_path(:type => "2"), :remote => true %></li>
<li><%= link_to "已关闭<span class='project-number-dot'>#{@requests_closed_count}</span>".html_safe, project_pull_requests_path(:type => "3"), :remote => true %></li>
<% if allow_pull_request(@project) %>
<% if allow_pull_request(@project) && User.current.member_of?(@project) %>
<%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
<% end %>
<div class="cl"></div>

View File

@ -68,7 +68,11 @@
) if activity.destroyable_by?(User.current) %>
</li>
<% end %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
<% if hidden_unproject_infos %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
<% else %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
<% end %>
</ul>
</li>
</ul>

View File

@ -35,7 +35,12 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<% if hidden_unproject_infos %>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<% else %>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{activity.id}',#{User.current.id},'news')") %></li>
<% end %>
<li>
<%= link_to(
l(:button_edit),

View File

@ -4,11 +4,18 @@
<% unless send_ids.blank? %>
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
<% if @hidden_unproject %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
<% else %>
<select class="resourcesSendType" onclick="chooseSendType2hidden('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1" >项目</option>
<option value="2" selected>组织</option>
</select>
<% end %>
</div>
<%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>

View File

@ -5,11 +5,18 @@
<% unless send_ids.blank? %>
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
</select>
<% if @hidden_unproject %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
</select>
<% else %>
<select class="resourcesSendType" onclick="chooseSendType2hidden('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1" selected>项目</option>
<option value="2">组织</option>
</select>
<% end %>
</div>
<div class="cl"></div>
</div>

View File

@ -87,6 +87,33 @@
}
function show_send_hidden(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}
line.children().css("background-color",'white');
id = line.children().last().html();
user_id = line.children().eq(5).html();
allow = line.children().eq(13).html();
if( allow == 0){
alert('您无权发送私有资源')
}else{
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
}else{
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>",
data:{send_type:'file'}
});
}
}
}
function batch_send(){
if($("#resources_list_form").serialize() == ""){
alert('暂时不支持多页选择,您当前页没有选择任何资源');
@ -121,6 +148,35 @@
}
}
// 隐藏非项目信息特用
function batch_send_hidden(){
if($("#resources_list_form").serialize() == ""){
alert('暂时不支持多页选择,您当前页没有选择任何资源');
return ;
}
if (lastSendType === '1'){
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
data:{send_type:'file'}
});
}else if (lastSendType === '2'){
$.ajax({
type: 'get',
url: '<%= search_user_org_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
data:{send_type:'file'}
});
}
else{
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type %>",
data:{send_type:'file'}
});
}
}
function preview(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}

View File

@ -24,6 +24,7 @@
</ul>
</li>
<% if hidden_unproject_infos %>
<div class="cl"></div>
<li>
<ul class="homepagePostTypeMore">
@ -35,7 +36,18 @@
<li class="fl w100"><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %></li>
</ul>
</li>
<% else %>
<li class="fl ml15">
<ul>
<li class="f14"><strong>更多</strong></li>
<li><%= link_to "所有消息",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %></li>
<li><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %></li>
<li><%= link_to "系统消息", user_system_messages_path(User.current, :type => 'system_messages'), :class => "homepageTypeSystem postTypeGrey" %></li>
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %></li>
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %></li>
</ul>
</li>
<% end %>
</ul>
</li>
</ul>

View File

@ -0,0 +1,12 @@
<% if @hidden_unproject %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3">组织</option>
</select>
<% else %>
<select class="resourcesSendType" onclick="chooseSendType2hidden('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">项目</option>
<option value="2">组织</option>
</select>
<% end %>

View File

@ -1,11 +1,18 @@
<div >
<div class="relateText fl mb10 mr5">发送到</div>
<div class="resourcesSendTo mr15">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','message');">
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
<% if @hidden_unproject %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
<% else %>
<select class="resourcesSendType" onclick="chooseSendType2hidden('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1" >项目</option>
<option value="2" selected>组织</option>
</select>
<% end %>
</div>
<%= form_tag search_user_org_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>

View File

@ -2,11 +2,18 @@
<div>
<div class="sendText fl mr10" style="width: auto">发送到</div>
<div class="resourcesSendTo">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','message');">
<option value="1">班级</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
</select>
<% if @hidden_unproject %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
</select>
<% else %>
<select class="resourcesSendType" onclick="chooseSendType2hidden('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1" selected>项目</option>
<option value="2">组织</option>
</select>
<% end %>
</div>
<div class="cl"></div>
</div>

View File

@ -1,11 +1,18 @@
<div >
<div class="relateText fl mb10 mr5">发送到</div>
<div class="resourcesSendTo mr15">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','news');">
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
<% if @hidden_unproject %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
<% else %>
<select class="resourcesSendType" onclick="chooseSendType2hidden('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1" >项目</option>
<option value="2" selected>组织</option>
</select>
<% end %>
</div>
<%= form_tag search_user_org_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>

View File

@ -2,11 +2,18 @@
<div>
<div class="sendText fl mr10" style="width: auto">发送到</div>
<div class="resourcesSendTo">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','news');">
<option value="1">班级</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
</select>
<% if @hidden_unproject %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">班级</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
</select>
<% else %>
<select class="resourcesSendType" onclick="chooseSendType2hidden('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1" selected>项目</option>
<option value="2">组织</option>
</select>
<% end %>
</div>
<div class="cl"></div>
</div>

View File

@ -23,9 +23,15 @@
<a href="javascript:void(0);" class="replyGrey" onclick="batch_delete();">删除</a> </div>
<div class="cl"></div>
<div class="resourcesSelectSend mt10 fl">
<div class="resourcesSelectSendButton fl mr15 inactive-border" onclick="batch_send();">
<a href="javascript:void(0);" class="sendButtonBlue db inactive-text" data-remote="true">发送至</a>
</div>
<% if hidden_unproject_infos %>
<div class="resourcesSelectSendButton fl mr15 inactive-border" onclick="batch_send();">
<a href="javascript:void(0);" class="sendButtonBlue db inactive-text" data-remote="true">发送至</a>
</div>
<% else %>
<div class="resourcesSelectSendButton fl mr15 inactive-border" onclick="batch_send_hidden();">
<a href="javascript:void(0);" class="sendButtonBlue db inactive-text" data-remote="true">发送至</a>
</div>
<% end %>
<div class="fl">选择&nbsp;<span class="c_red" id="res_count">0</span>&nbsp;个资源</div>
</div>
@ -45,7 +51,11 @@
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
<!-- data-remote="true" 这个属性会让ajax请求状态标志就在当前按钮的上方显示就不会滚动浏览器因而弹出框也会在当前窗口中央展示-->
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send();" onfocus="this.blur()" >发送</a></li>
<% if hidden_unproject_infos %>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send();" onfocus="this.blur()" >发送</a></li>
<% else %>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send_hidden();" onfocus="this.blur()" >发送</a></li>
<% end %>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
</ul>
</ul>

View File

@ -21,9 +21,7 @@
<%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %>
<%# 课程消息 %>
<% if hidden_unproject_infos %>
<%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %>
<% end %>
<%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %>
<!--项目消息-->
<%= render :partial => 'users/user_message_forge', :locals => {:ma => ma} %>

View File

@ -8,12 +8,6 @@
function remote_get_resources(user_id,type){
}
$(document).ready(function(){
$(".resource-switch").click(function(){
$(".resource-switch").children().removeClass("resource-tab-active");
$(this).children().addClass("resource-tab-active");
});
});
function remote_search(){
$("#resource_search_form").submit();
}
@ -75,5 +69,10 @@
<div class="cl"></div>
<script>
$(".resource-switch").click(function(){
$(".resource-switch").children().removeClass("resource-tab-active");
$(this).children().addClass("resource-tab-active");
});
</script>

View File

@ -1153,6 +1153,31 @@ function show_send(id, user_id, send_type){
}
}
//为了隐藏非项目功能
//var sendType = '1';
var lastSendType ;//初始为发送到我的项目
function show_send_hidden(id, user_id, send_type){
if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({
type: 'get',
url: '/users/' + user_id + '/search_user_project',
data:{send_id:id, send_type:send_type}
});
}else if( lastSendType == '2'){//组织
$.ajax({
type: 'get',
url: '/users/' + user_id + '/search_user_org',
data:{send_id:id, send_type:send_type}
});
}else{
$.ajax({
type: 'get',
url: '/users/' + user_id + '/search_user_project',
data:{send_id:id, send_type:send_type}
});
}
}
//id 发送的id
//发送的id数组
//send_type:发送的类型file对应文件message对应帖子news对应通知或新闻
@ -1216,6 +1241,30 @@ function chooseSendType2(res_id,res_ids, user_id, send_type, type){
lastSendType = sendType;
}
//隐藏项目其它信息特用
function chooseSendType2hidden(res_id,res_ids, user_id, send_type, type){
console.log(res_ids);
sendType = $(".resourcesSendType").val();
if (sendType === lastSendType) {
return;
} else if(lastSendType != null) { //不是第一次点击的时候
if (sendType == '1') {
$.ajax({
type: 'get',
url: '/users/' + user_id + '/search_user_project' + '?' + "&type=" + type,
data:{send_id:res_id, send_ids:res_ids ,send_type:send_type}
});
}else if(sendType == '2'){
$.ajax({
type: 'get',
url: '/users/' + user_id + '/search_user_org' + '?' + "&type=" + type,
data:{send_id:res_id, send_ids:res_ids, send_type:send_type}
});
}
}
lastSendType = sendType;
}
//组织新建和配置中选择组织为私有后disbled掉允许游客下载选项
function disable_down(source, des, hint){
if (source.attr("checked")){

View File

@ -455,8 +455,8 @@ a.topnav_login_box:hover {color:#a1ebff;}
/*底部*/
#Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}
.footerAbout{ width:365px; margin:0 auto;height:35px; line-height:35px; padding-top: 10px;}
.footerAboutContainer {width:auto; border-bottom:1px solid #efefef; text-align:center;}
.footerAbout{margin:0 auto;height:35px; line-height:35px; padding-top: 10px; display:inline-block;}
.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}
.departments{ width:855px; margin:5px auto;height:40px;line-height:40px;}
.departments li {height:40px; line-height:40px;}