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/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3cec4cbc7..d0ec28317 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index b863c1f70..f2b2b6824 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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表中的邮箱信息 diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index e567435a5..de37ed054 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -63,7 +63,11 @@
  • <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
    - <% hidden_courses = Setting.find_by_name("hidden_courses") %> - <% unvisiable = hidden_courses && hidden_courses.value == "1"%> - <% if !unvisiable %> + <% if hidden_unproject_infos %>
    - <%= render :partial => 'layouts/forbidden_new_feedback' %> + <% if hidden_unproject_infos %> + <%= render :partial => 'layouts/forbidden_new_feedback' %> + <% end %>
    <%= render :partial => 'layouts/footer_show' %> diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index ff358f7c3..41c2f7d1f 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -116,7 +116,11 @@ ) if @message.destroyable_by?(User.current) %>
  • <% end %> -
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
  • + <% if hidden_unproject_infos %> +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
  • + <% else %> +
  • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
  • + <% end %> diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 9d043fbb5..a414a1181 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -61,19 +61,21 @@ <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> <% when 'course' %> -
    -
    - 班级 - <% 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 %> -
    -
    - -
    -
    + <% if hidden_unproject_infos %> +
    +
    + 班级 + <% 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 %> +
    +
    + +
    +
    + <% end %> <% when 'project' %>
    diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index ab3120a5d..690750fd2 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -20,6 +20,7 @@
    <% end %> - +<% if allow_pull_request(@project) %> + +<% end %> <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> <% if visible_repository?(@project) %> diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 161221526..6b3e8e43c 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -38,7 +38,12 @@
  • <% if User.current.logged? %>
  • diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 4c7ec2b04..284f5b821 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -35,7 +35,12 @@
  • <% if User.current.logged? %>
  • <%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index b521bcb90..41133a91e 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -5,11 +5,18 @@ <% unless send_ids.blank? %> <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
    diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 3f5138107..77a2386fe 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -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;} diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb index 14609f4fc..1e2e40e06 100644 --- a/app/views/users/_selector_for_messages.html.erb +++ b/app/views/users/_selector_for_messages.html.erb @@ -24,6 +24,7 @@ + <% if hidden_unproject_infos %>
  • - + <% else %> +
  • + +
  • + <% 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/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb index 37575a8d5..8c1d81140 100644 --- a/app/views/users/_share_message_to_org.html.erb +++ b/app/views/users/_share_message_to_org.html.erb @@ -1,11 +1,18 @@
    发送到
    - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
    <%= form_tag search_user_org_user_path(user),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb index 89b36e22a..21abd85de 100644 --- a/app/views/users/_share_message_to_project.html.erb +++ b/app/views/users/_share_message_to_project.html.erb @@ -2,11 +2,18 @@
    发送到
    - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
    diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb index 85d5e7104..c40e05199 100644 --- a/app/views/users/_share_news_to_org.html.erb +++ b/app/views/users/_share_news_to_org.html.erb @@ -1,11 +1,18 @@
    发送到
    - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
    <%= form_tag search_user_org_user_path(user),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb index d4c293304..c9c60198f 100644 --- a/app/views/users/_share_news_to_project.html.erb +++ b/app/views/users/_share_news_to_project.html.erb @@ -2,11 +2,18 @@
    发送到
    - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
    diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index e00489193..d3b169a17 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -23,9 +23,15 @@ 删除
    -
    - 发送至 -
    + <% if hidden_unproject_infos %> +
    + 发送至 +
    + <% else %> +
    + 发送至 +
    + <% end %>
    选择 0 个资源
    @@ -45,7 +51,11 @@
  • 预览
  • 重命名
  • -
  • 发送
  • + <% if hidden_unproject_infos %> +
  • 发送
  • + <% else %> +
  • 发送
  • + <% end %>
  • 删除
  • diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 578e97b9a..2baa9f2f2 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -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} %> diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index ee2ea7e4f..6c0e067db 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -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 @@
    - + 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")){ diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 729bf2f4a..7004c0928 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -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;}