diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index a44a3bc01..b385fe610 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -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
diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb
index a0ce42eac..5d96d8da2 100644
--- a/app/views/files/_tool_settings.html.erb
+++ b/app/views/files/_tool_settings.html.erb
@@ -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") %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <% if hidden_unproject_infos %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <% else %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
+ <% end %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
<% if project.is_public? %>
-
@@ -20,7 +24,11 @@
<% end %>
<% else %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <% if hidden_unproject_infos %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
+ <% else %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
+ <% end %>
<% end %>
<% end %>
diff --git a/app/views/users/_send_part.html.erb b/app/views/users/_send_part.html.erb
new file mode 100644
index 000000000..b47386da8
--- /dev/null
+++ b/app/views/users/_send_part.html.erb
@@ -0,0 +1,12 @@
+<% if @hidden_unproject %>
+
+<% else %>
+
+<% end %>
\ No newline at end of file
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index c2e357e0f..d576ba42f 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -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")){