Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
3b84cd3ed2
|
@ -1987,7 +1987,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif params[:send_ids].present?
|
elsif params[:send_ids].present?
|
||||||
send_ids = params[:send_ids].split(" ")
|
send_ids = params[:send_ids].split(",")
|
||||||
course_ids = params[:course_ids]
|
course_ids = params[:course_ids]
|
||||||
if course_ids.nil?
|
if course_ids.nil?
|
||||||
@flag = false
|
@flag = false
|
||||||
|
@ -2105,7 +2105,8 @@ class UsersController < ApplicationController
|
||||||
project_ids.each do |project_id|
|
project_ids.each do |project_id|
|
||||||
next if ori.blank?
|
next if ori.blank?
|
||||||
@exist = false
|
@exist = false
|
||||||
Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
|
# 如果对象中包含该资源
|
||||||
|
Project.find(project_id).attachments.each do |att|
|
||||||
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
|
||||||
att.created_on = Time.now
|
att.created_on = Time.now
|
||||||
att.save
|
att.save
|
||||||
|
@ -2138,7 +2139,7 @@ class UsersController < ApplicationController
|
||||||
@ori = ori
|
@ori = ori
|
||||||
end
|
end
|
||||||
elsif params[:send_ids].present?
|
elsif params[:send_ids].present?
|
||||||
send_ids = params[:send_ids].split(" ")
|
send_ids = params[:send_ids].split(",")
|
||||||
project_ids = params[:projects_ids]
|
project_ids = params[:projects_ids]
|
||||||
if project_ids.nil?
|
if project_ids.nil?
|
||||||
@flag = false
|
@flag = false
|
||||||
|
@ -2285,7 +2286,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
@ori = ori
|
@ori = ori
|
||||||
elsif params[:send_ids].present?
|
elsif params[:send_ids].present?
|
||||||
send_ids = params[:send_ids].split(" ")
|
send_ids = params[:send_ids].split(",")
|
||||||
subfield_id = params[:subfield]
|
subfield_id = params[:subfield]
|
||||||
if subfield_id.nil?
|
if subfield_id.nil?
|
||||||
@flag = false
|
@flag = false
|
||||||
|
@ -3126,6 +3127,7 @@ class UsersController < ApplicationController
|
||||||
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@type = params[:type]
|
||||||
@search = params[:search]
|
@search = params[:search]
|
||||||
#这里仅仅是传递需要发送的资源id
|
#这里仅仅是传递需要发送的资源id
|
||||||
@send_id = params[:send_id]
|
@send_id = params[:send_id]
|
||||||
|
|
|
@ -2098,12 +2098,12 @@ module ApplicationHelper
|
||||||
def attachment_history_candown attachment_history
|
def attachment_history_candown attachment_history
|
||||||
if attachment_history.container_type == "Course"
|
if attachment_history.container_type == "Course"
|
||||||
course = Course.find(attachment_history.container_id)
|
course = Course.find(attachment_history.container_id)
|
||||||
candown = User.current.member_of?(course) || (course.is_public && attachment_history.is_public == 1)
|
candown = User.current.member_of_course?(course) || (course.is_public && attachment_history.is_public == 1)
|
||||||
elsif attachment_history.container_type == "Project"
|
elsif attachment_history.container_type == "Project"
|
||||||
project = Project.find(attachment_history.container_id)
|
project = Project.find(attachment_history.container_id)
|
||||||
candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1)
|
candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1)
|
||||||
elsif attachment_history.container_type == "OrgSubfield"
|
elsif attachment_history.container_type == "OrgSubfield"
|
||||||
org = OrgSubfield.find(attachment_history.container_id)
|
org = OrgSubfield.find(attachment_history.container_id).organization
|
||||||
candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1 && (User.current.logged? || org.organization.allow_guest_download?))
|
candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1 && (User.current.logged? || org.organization.allow_guest_download?))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh
|
||||||
showModal('ajax-modal', '452px');
|
showModal('ajax-modal', '452px');
|
||||||
$('#ajax-modal').siblings().remove();
|
$('#ajax-modal').siblings().remove();
|
||||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
$('#ajax-modal').parent().css("top","40%").css("left","50%").css("position","fixed");
|
||||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
|
@ -1,4 +1,4 @@
|
||||||
<%= form_tag add_exist_file_to_org_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'orgs_list_form' do %>
|
<%= form_tag add_exist_file_to_org_user_path(user, :type => @type ),:remote=>true,:id=>'orgs_list_form' do %>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
<div class="sectionWrap fl mr15">
|
<div class="sectionWrap fl mr15">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<%= form_tag add_exist_file_to_project_user_path(user, :type => defined?(type) ? type : "6" ), :remote => true, :id => 'projects_list_form' %>
|
<%= form_tag add_exist_file_to_project_user_path(user, :type => @type ), :remote => true, :id => 'projects_list_form' %>
|
||||||
<div>
|
<div>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
<div >
|
<div >
|
||||||
<div class="relateText fl mb10 mr5">发送到</div>
|
<div class="relateText fl mb10 mr5">发送到</div>
|
||||||
<div class="resourcesSendTo mr15">
|
<div class="resourcesSendTo mr15">
|
||||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','file');">
|
<% 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="1">课程</option>
|
||||||
<option value="2">项目</option>
|
<option value="2">项目</option>
|
||||||
<option value="3" selected>组织</option>
|
<option value="3" selected>组织</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<%= form_tag search_user_org_user_path(user),:method => 'get',
|
<%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get',
|
||||||
:remote=>true,:id=>'search_user_org_form' do %>
|
:remote=>true,:id=>'search_user_org_form' do %>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
|
@ -19,5 +22,5 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="org_file_form">
|
<div id="org_file_form">
|
||||||
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => type} %>
|
<%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids, :type => @type} %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
||||||
<div class="resourcesSendTo">
|
<div class="resourcesSendTo">
|
||||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','file');">
|
<% 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="1">课程</option>
|
||||||
<option value="2" selected>项目</option>
|
<option value="2" selected>项目</option>
|
||||||
<option value="3">组织</option>
|
<option value="3">组织</option>
|
||||||
|
@ -12,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||||
<div class="fl">
|
<div class="fl">
|
||||||
<%= form_tag search_user_project_user_path(user),:method => 'get',
|
<%= form_tag search_user_project_user_path(user, :type => @type),:method => 'get',
|
||||||
:remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %>
|
:remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
||||||
<div class="resourcesSendTo">
|
<div class="resourcesSendTo">
|
||||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','file');">
|
<% 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="1">课程</option>
|
||||||
<option value="2">项目</option>
|
<option value="2">项目</option>
|
||||||
<option value="3">组织</option>
|
<option value="3">组织</option>
|
||||||
|
@ -14,10 +17,9 @@
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||||
<div class="fl">
|
<div class="fl">
|
||||||
<%= form_tag search_user_course_user_path(user),:method => 'get',
|
<%= form_tag search_user_course_user_path(user),:method => 'get', :remote=>true, :id=> 'search_user_course_form', :class=> 'resourcesSearchBox' do %>
|
||||||
:remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
|
||||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
|
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
|
||||||
<script>
|
<script>
|
||||||
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','file')
|
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','file')
|
||||||
|
|
|
@ -99,13 +99,26 @@
|
||||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '<%= search_user_project_user_path(User.current.id)%>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type%>",
|
url: '<%= search_user_project_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
|
||||||
data:{send_type:'file'}
|
data:{send_type:'file'}
|
||||||
});
|
});
|
||||||
}else{
|
}else if (lastSendType === '1'){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '<%= search_user_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type%>",
|
url: '<%= search_user_course_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
|
||||||
|
data:{send_type:'file'}
|
||||||
|
});
|
||||||
|
}else if (lastSendType === '3'){
|
||||||
|
$.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_course_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type %>",
|
||||||
data:{send_type:'file'}
|
data:{send_type:'file'}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<form id="resources_list_form">
|
<form id="resources_list_form">
|
||||||
<div id="resources_list">
|
<div id="resources_list">
|
||||||
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments} %>
|
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments, :type => @type} %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
<% if params[:is_observe].nil? %>
|
<% if params[:is_observe].nil? %>
|
||||||
<% if params[:send_type].present? && params[:send_type] == 'news' %>
|
<% if params[:send_type].present? && params[:send_type] == 'news' %>
|
||||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<!--<li class="fl resource-switch">-->
|
<!--<li class="fl resource-switch">-->
|
||||||
<!--<a href="<%#= user_resource_user_path(@user, :type => '2', :status => 6) %>" class="resource-tab" id="private_resource_list" data-remote="true">申请资源</a>-->
|
<!--<a href="<%#= user_resource_user_path(@user, :type => '2', :status => 6) %>" class="resource-tab" id="private_resource_list" data-remote="true">申请资源</a>-->
|
||||||
<!--</li>-->
|
<!--</li>-->
|
||||||
<li class="fl w680 border-bottom h34"> </li>
|
<li class="fl w770 border-bottom h34"> </li>
|
||||||
<li class="fr resource-banner-li border-bottom h34">
|
<li class="fr resource-banner-li border-bottom h34">
|
||||||
<div id="user_resource_type_filter">
|
<div id="user_resource_type_filter">
|
||||||
<%= render :partial => 'user_resource_type_filter' %>
|
<%= render :partial => 'user_resource_type_filter' %>
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 17 KiB |
|
@ -1178,6 +1178,37 @@ function chooseSendType(res_id,res_ids, user_id, send_type){
|
||||||
lastSendType = sendType;
|
lastSendType = sendType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function chooseSendType2(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_course' + '?' + "&type=" + type,
|
||||||
|
data:{send_id:res_id, send_ids:res_ids ,send_type:send_type}
|
||||||
|
});
|
||||||
|
} else if(sendType == '2') {
|
||||||
|
console.log(res_ids);
|
||||||
|
$.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 == '3'){
|
||||||
|
$.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掉允许游客下载选项
|
//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项
|
||||||
function disable_down(source, des, hint){
|
function disable_down(source, des, hint){
|
||||||
if (source.attr("checked")){
|
if (source.attr("checked")){
|
||||||
|
|
Loading…
Reference in New Issue