diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 38402f68e..ee098cf42 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -281,4 +281,12 @@ class OrganizationsController < ApplicationController
format.js
end
end
+
+ def org_resources_subfield
+ @org = Organization.find(params[:id])
+ @subfield = @org.org_subfields.where('field_type = "Resource" ')
+ respond_to do | format|
+ format.js
+ end
+ end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 281b8b7e0..4d8eaf2cb 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1613,6 +1613,77 @@ class UsersController < ApplicationController
end
end
+ def add_exist_file_to_org
+ @flag = true
+ if params[:send_id].present?
+ send_id = params[:send_id]
+ subfield_id = params[:subfield_id]
+ if subfield_id.nil?
+ @flag = false
+ end
+ ori = Attachment.find_by_id(send_id)
+ unless org_id.nil?
+ attach_copied_obj = ori.copy
+ attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
+ attach_copied_obj.container = OrgSubfield.find(subfield_id)
+ attach_copied_obj.created_on = Time.now
+ attach_copied_obj.author_id = User.current.id
+ if attach_copied_obj.attachtype == nil
+ attach_copied_obj.attachtype = 1
+ end
+ attach_copied_obj.save
+ end
+ elsif params[:send_ids].present?
+ send_ids = params[:send_ids].split(" ")
+ project_ids = params[:projects_ids]
+ if project_ids.nil?
+ @flag = false
+ end
+ send_ids.each do |send_id|
+
+ ori = Attachment.find_by_id(send_id)
+ unless project_ids.nil?
+ project_ids.each do |project_id|
+ next if ori.blank?
+ attach_copied_obj = ori.copy
+ attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
+ attach_copied_obj.container = Project.find(project_id)
+ attach_copied_obj.created_on = Time.now
+ attach_copied_obj.author_id = User.current.id
+ if attach_copied_obj.attachtype == nil
+ attach_copied_obj.attachtype = 1
+ end
+ attach_copied_obj.save
+ end
+ end
+ end
+ else
+ @flag=true
+ end
+ user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
+ @type = params[:type]
+ @limit = 25
+ @user = User.current
+ @is_remote = true
+ @atta_count = @attachments.count
+ @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
+ @offset ||= @atta_pages.offset
+ #@curse_attachments_all = @all_attachments[@offset, @limit]
+ @attachments = paginateHelper @attachments,25
+ respond_to do |format|
+ format.js
+ end
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def change_org_subfield
+
+ end
+
# 资源预览
def resource_preview
preview_id = params[:resource_id]
@@ -1954,6 +2025,23 @@ class UsersController < ApplicationController
end
end
+ def search_user_org
+ @user = User.current
+ if !params[:search].nil?
+ search = "%#{params[:search].to_s.strip.downcase}%"
+ @orgs = @user.organizations.where("name like ?", search)
+ else
+ @orgs = @user.organizations
+ end
+ @search = params[:search]
+ #这里仅仅是传递需要发送的资源id
+ @send_id = params[:send_id]
+ @send_ids = params[:checkbox1] || params[:send_ids]
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
def find_user
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index ad5655b02..ae23428f1 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -32,6 +32,7 @@ class Attachment < ActiveRecord::Base
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end
include UserScoreHelper
+ has_many :attachment_histories
validates :filename, presence: true, length: {maximum: 254}
validates :author, presence: true
diff --git a/app/models/attachment_history.rb b/app/models/attachment_history.rb
new file mode 100644
index 000000000..4ff1ddd0d
--- /dev/null
+++ b/app/models/attachment_history.rb
@@ -0,0 +1,3 @@
+class AttachmentHistory < ActiveRecord::Base
+ belongs_to :attachment,foreign_key: 'attach_id'
+end
diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb
index 2eaa2a904..0212ce8bd 100644
--- a/app/views/files/_course_list.html.erb
+++ b/app/views/files/_course_list.html.erb
@@ -34,36 +34,34 @@
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
- <% if User.current.logged? %>
- <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
+
-
-
+ <% if User.current.logged? %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
+ <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
+ - <%= link_to '更新版本','',:class => "postOptionLink",:remote=>true %>
<% if @course.is_public? %>
- -
-
+
-
+
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
-
-
- <%else%>
-
+
+
<%end%>
- -
- <%= link_to( '删除资源', attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%>
+
-
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%>
+
-
-
-
-
<% end %>
+ <% end %>
+ <% end %>
- <% end %>
- <% end %>
+
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index 98c1cb684..6db472cda 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -185,6 +185,20 @@
}
+
+ function org_id_click(){
+ var sendText = $("input[name='org_id']:checked").next().text();
+ var orgDirection = "目标地址:"
+ $(".orgDirection").text(orgDirection + sendText);
+ }
+ function subfield_click(){
+ var sendText = $("input[name='org_id']:checked").next().text();
+ var orgDirection = "目标地址:"
+ var sendColumn = $("input[name='subfield']:checked").next().text();
+ $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
+ }
+
+
function course_attachmenttypes_change(id, type) {
<% if @course%>
$.ajax({
@@ -231,6 +245,89 @@
});
}
+ function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) {
+ $('#'+fieldId).each(function() {
+ var $this = $(this);
+ $this.addClass('autocomplete');
+ $this.attr('data-value-was', $this.val());
+ var check = function() {
+ var val = $this.val();
+ if ($this.attr('data-value-was') != val){
+ $this.attr('data-value-was', val);
+ $.ajax({
+ url: url,
+ type: 'get',
+ data: {search: $this.val(),send_id:send_id,send_ids:send_ids},
+ success: function(data){ },
+ beforeSend: function(){ $this.addClass('ajax-loading'); },
+ complete: function(){ $this.removeClass('ajax-loading'); }
+ });
+ }
+ };
+ var reset = function() {
+ if (timer) {
+ clearInterval(timer);
+ timer = setInterval(check, 300);
+ }
+ };
+ var timer = setInterval(check, 300);
+ $this.bind('keyup click mousemove', reset);
+ });
+ }
+
+ <% if User.current.logged? %>
+ var sendType = '1';
+ var lastSendType ;//初始为发送到我的课程
+ function show_send(id){
+ if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
+ });
+ }else if(lastSendType == '1'){
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
+ });
+ }else if( lastSendType == '3'){//组织
+
+ }else{
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
+ });
+ }
+ }
+
+ //id 发送的id
+ //发送的id数组
+ function chooseSendType(res_id,res_ids){
+
+ sendType = $(".resourcesSendType").val();
+ if (sendType === lastSendType) {
+ return;
+ } else if(lastSendType != null) { //不是第一次点击的时候
+ if (sendType == '1') {
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
+ });
+ } else if(sendType == '2') {
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
+ });
+ }else if(sendType == '3'){
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
+ });
+ }
+ }
+
+ lastSendType = sendType;
+ }
+ <% end %>
<% if @course %>
var tagNameHtml; //当前双击的链接的父节点的html
var tagName; //标签的值
diff --git a/app/views/organizations/org_resources_subfield.js.erb b/app/views/organizations/org_resources_subfield.js.erb
new file mode 100644
index 000000000..6c1f2d690
--- /dev/null
+++ b/app/views/organizations/org_resources_subfield.js.erb
@@ -0,0 +1,2 @@
+$(".columnContent").html('<%= escape_javascript( render :partial => 'users/org_resources_subfield',:locals => {:subfield=>@subfield})%>')
+$(".orgDirection").text('目标地址:'+'<%= @org.name.html_safe%>')
\ No newline at end of file
diff --git a/app/views/users/_org_resources_subfield.html.erb b/app/views/users/_org_resources_subfield.html.erb
new file mode 100644
index 000000000..989191dc7
--- /dev/null
+++ b/app/views/users/_org_resources_subfield.html.erb
@@ -0,0 +1,10 @@
+请选择栏目:
+<% unless subfield.nil? || subfield.empty? %>
+ <% subfield.each do |field| %>
+
+
+
+ <%end %>
+<%end %>
\ No newline at end of file
diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb
new file mode 100644
index 000000000..f35b2faec
--- /dev/null
+++ b/app/views/users/_resource_share_for_orgs.html.erb
@@ -0,0 +1,56 @@
+
+
发送到
+
+
+
+ <%= form_tag search_user_org_user_path(user),:method => 'get',
+ :remote=>true,:id=>'search_user_org_form' do %>
+ <%= hidden_field_tag(:send_id, send_id) %>
+ <%= hidden_field_tag(:send_ids, send_ids) %>
+
+
+ <% end %>
+
+
+<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
+
+
+
+
+
+ <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
+
+
+
+
+
+
+
+
+ 目标地址:
+
+ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
+
+
+
+ <%end %>
\ No newline at end of file
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 ba136899c..bdf4ef439 100644
--- a/app/views/users/_resource_share_for_project_popup.html.erb
+++ b/app/views/users/_resource_share_for_project_popup.html.erb
@@ -2,11 +2,12 @@
-
将资源发送至
+
将资源发送到
@@ -47,7 +48,7 @@
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
-
+
<% end %>
diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb
index 53fb6673b..b1f6270b0 100644
--- a/app/views/users/_resource_share_popup.html.erb
+++ b/app/views/users/_resource_share_popup.html.erb
@@ -7,6 +7,7 @@
@@ -47,7 +48,7 @@
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
-
+
<% end %>
diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb
index 95f7784f7..57fe9d42d 100644
--- a/app/views/users/add_exist_file_to_course.js.erb
+++ b/app/views/users/add_exist_file_to_course.js.erb
@@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);
-closePopUp();
+hideModal();
alert("发送成功")
<% else%>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb
index 95f7784f7..57fe9d42d 100644
--- a/app/views/users/add_exist_file_to_project.js.erb
+++ b/app/views/users/add_exist_file_to_project.js.erb
@@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);
-closePopUp();
+hideModal();
alert("发送成功")
<% else%>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/change_org_subfield.js.erb b/app/views/users/change_org_subfield.js.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb
index 2a0c98cad..f32ed521a 100644
--- a/app/views/users/search_user_course.js.erb
+++ b/app/views/users/search_user_course.js.erb
@@ -9,10 +9,10 @@
//$("#upload_box").css('left','').css('top','');
//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
//$("#upload_box").css('display','block');
-$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("");
+$('#ajax-modal').before("");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb
new file mode 100644
index 000000000..94ac37968
--- /dev/null
+++ b/app/views/users/search_user_org.js.erb
@@ -0,0 +1,9 @@
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
+showModal('ajax-modal', '452px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before("");
+$('#ajax-modal').parent().css("top","").css("left","");
+$('#ajax-modal').parent().addClass("popbox").addClass("shareDP");
+$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
+var val = $("#search_org_input").val();
+$("#search_org_input").val("").focus().val(val);
\ No newline at end of file
diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb
index f38d9edc8..b99d36348 100644
--- a/app/views/users/search_user_project.js.erb
+++ b/app/views/users/search_user_project.js.erb
@@ -8,7 +8,7 @@
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("");
+$('#ajax-modal').before("");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox")
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index 418809917..09f8a998d 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -467,11 +467,17 @@
type: 'get',
url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id
});
- } else {
+ } else if(sendType === '2') {
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id
});
+ }else if(sendType ==='3')
+ {
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id
+ });
}
}else{//如果是多个发送
if (sendType === '1'){
@@ -479,11 +485,16 @@
type: 'get',
url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize()
});
- }else{
+ }else if(sendType === '2'){
$.ajax({
type: 'get',
url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize()
});
+ }else if(sendType === '3'){
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize()
+ });
}
}
}
@@ -521,5 +532,12 @@
});
}
+ function subfield_click(){
+ var sendText = $("input[name='org_id']:checked").next().text();
+ var orgDirection = "目标地址:"
+ var sendColumn = $("input[name='subfield']:checked").next().text();
+ $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
+ }
+
diff --git a/config/routes.rb b/config/routes.rb
index 4121639c0..b9622c047 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -47,6 +47,7 @@ RedmineApp::Application.routes.draw do
post 'join_project_menu'
post 'join_projects'
post 'logout'
+ get 'org_resources_subfield'
end
collection do
get 'check_uniq'
@@ -500,6 +501,7 @@ RedmineApp::Application.routes.draw do
get "search_user_course"
post "add_exist_file_to_course"
post "add_exist_file_to_project"
+ post 'add_exist_file_to_org'
get 'resource_preview'
get 'rename_resource'
get 'search_user_project'
@@ -510,6 +512,8 @@ RedmineApp::Application.routes.draw do
get 'store_selected_resource'
get 'user_organizations'
get 'search_user_orgs'
+ get 'search_user_org' #for send resource
+
# end
end
#resources :blogs
diff --git a/db/migrate/20151229045505_create_attachment_histories.rb b/db/migrate/20151229045505_create_attachment_histories.rb
new file mode 100644
index 000000000..21b599a96
--- /dev/null
+++ b/db/migrate/20151229045505_create_attachment_histories.rb
@@ -0,0 +1,24 @@
+class CreateAttachmentHistories < ActiveRecord::Migration
+ def change
+ create_table :attachment_histories do |t|
+ t.integer :container_id
+ t.string :container_type
+ t.string :filename , :default => ""
+ t.string :disk_filename, :default => ""
+ t.integer :filesize, :default => 0
+ t.string :content_type, :default => ""
+ t.string :digest , :default => "",:limit=>40
+ t.integer :downloads, :default => 0
+ t.integer :author_id
+ t.datetime :created_on
+ t.string :description
+ t.string :disk_directory
+ t.integer :attachtype
+ t.integer :is_public
+ t.integer :copy_from
+ t.integer :quotes
+ t.integer :version
+ t.integer :version_id
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8e946c493..8e9bff4e2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20151218110033) do
+ActiveRecord::Schema.define(:version => 20151229045505) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -80,6 +80,27 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id"
+ create_table "attachment_histories", :force => true do |t|
+ t.integer "container_id"
+ t.string "container_type"
+ t.string "filename", :default => ""
+ t.string "disk_filename", :default => ""
+ t.integer "filesize", :default => 0
+ t.string "content_type", :default => ""
+ t.string "digest", :limit => 40, :default => ""
+ t.integer "downloads", :default => 0
+ t.integer "author_id"
+ t.datetime "created_on"
+ t.string "description"
+ t.string "disk_directory"
+ t.integer "attachtype"
+ t.integer "is_public"
+ t.integer "copy_from"
+ t.integer "quotes"
+ t.integer "version"
+ t.integer "version_id"
+ end
+
create_table "attachments", :force => true do |t|
t.integer "container_id"
t.string "container_type", :limit => 30
@@ -97,6 +118,7 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
t.integer "is_public", :default => 1
t.integer "copy_from"
t.integer "quotes"
+ t.integer "version", :default => 0
end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
@@ -558,26 +580,23 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
- create_table "dts", :primary_key => "Num", :force => true do |t|
- t.string "Defect", :limit => 50
- t.string "Category", :limit => 50
- t.string "File"
- t.string "Method"
- t.string "Module", :limit => 20
- t.string "Variable", :limit => 50
- t.integer "StartLine"
- t.integer "IPLine"
- t.string "IPLineCode", :limit => 200
- t.string "Judge", :limit => 15
- t.integer "Review", :limit => 1
+ create_table "dts", :force => true do |t|
+ t.string "IPLineCode"
t.string "Description"
- t.text "PreConditions", :limit => 2147483647
- t.text "TraceInfo", :limit => 2147483647
- t.text "Code", :limit => 2147483647
+ t.string "Num"
+ t.string "Variable"
+ t.string "TraceInfo"
+ t.string "Method"
+ t.string "File"
+ t.string "IPLine"
+ t.string "Review"
+ t.string "Category"
+ t.string "Defect"
+ t.string "PreConditions"
+ t.string "StartLine"
t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "id", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "editor_of_documents", :force => true do |t|
@@ -926,6 +945,16 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
+ create_table "journal_details_copy", :force => true do |t|
+ t.integer "journal_id", :default => 0, :null => false
+ t.string "property", :limit => 30, :default => "", :null => false
+ t.string "prop_key", :limit => 30, :default => "", :null => false
+ t.text "old_value"
+ t.text "value"
+ end
+
+ add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
+
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 3d9fba942..8932f98a3 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -978,6 +978,15 @@ $(document).ready(function () {
}
});
+//点击发送资源弹出框中的组织,要更改选择栏目中的内容
+//@dom 选中的radio,值为org_id
+function change_org_subfield(url){
+ $.ajax({
+ type:'get',
+ url:url
+ })
+}
+
//点击图片即显示大图
function showNormalImage(id) {
var description_images=$('div#'+id).find("img");
@@ -1001,4 +1010,4 @@ $(function(){
var userId = $(this).attr('data-user-id');
$(window.location).attr('href', '/users/'+userId);
});
-});
\ No newline at end of file
+});
diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css
index 9b6f4f9fe..9df67452f 100644
--- a/public/stylesheets/new_user.css
+++ b/public/stylesheets/new_user.css
@@ -1392,3 +1392,19 @@ span.at {color:#269ac9;}
.function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}
.weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;}
+/*资源发送到org*/
+.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;}
+.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;}
+.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;}
+.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;}
+.columnWrap li {padding-left:10px; color:#585858; line-height:20px;}
+.columnWrap li:hover {background-color:#cccccc;}
+.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;}
+.sectionRow:hover {background-color:#cccccc; cursor:pointer;}
+.sectionContent {}
+.sectionContent li {padding-left:10px; line-height:20px;}
+.sectionContent li:hover {background-color:#cccccc;}
+.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;}
+.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;}
+.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;}
+
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 394a0cb12..c0336ddcd 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -408,23 +408,35 @@ a:hover.search_btn{ background: #0fa9bb;}
/*发送资源弹窗*/
/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/
-.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
-.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:100px; display:inline-block; font-weight:bold;}
+/*发送资源弹窗*/
+/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/
+/*.resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}*/
+.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
+.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;}
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
+.boxContainer {height:33px; line-height:33px; position:relative}
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
.resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
-.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;}
+.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;}
+.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;}
+.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;}
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
-.sendCourseName {font-size:12px; color:#5f6060;}
-.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;}
+.sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
+.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;}
.courseSendSubmit:hover {background-color:#297fb8;}
.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
-.courseSendCancel:hover {background-color:#717171;}
-.courseReferContainer {float:left; max-height:120px; overflow:scroll; overflow-x:hidden; margin-right:16px; margin-bottom:10px;}
-a.sendSourceText {font-size:14px; color:#ffffff; display:block;}
+.courseSendCancel:hover {background-color: #717171;}
+a.sendSourceText {font-size:14px; color:#ffffff;}
+input.sendSourceText {font-size:14px;color:#ffffff;background-color:#269ac9;cursor: pointer; outline: none; border: none; width: 50px; height: 25px;}
+input.sendSourceText:hover {background-color:#297fb8;}
+/*input.sendSourceText:hover {font-size:14px; color:#ffffff;}*/
+.resourcesSendTo {float:left; height:20px; margin-top:15px;}
+.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
+.courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;}
+.popbox{/* width:300px; *//* height:100px; */position:fixed !important;/* z-index:100; */left:50%;top:50%;margin:-100px 0 0 -150px; /* background:#fff; */ -moz-border-radius:5px; /* -webkit-border-radius:5px; */ /* border-radius:5px; */ /* box-shadow:0px 0px 8px #194a81; */ /* overflow:auto; */}
/*上传资源弹窗*/
.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
@@ -924,4 +936,19 @@ span.at {color:#269ac9;}
.codeIcon {background:url(../images/hwork_icon.png) -78px -160px no-repeat; padding-left:23px;}
.othersIcon {background:url(../images/hwork_icon.png) -3px -210px no-repeat; padding-left:23px;}
.thesisIcon {background:url(../images/hwork_icon.png) -78px -212px no-repeat; padding-left:23px;}
-.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
\ No newline at end of file
+.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
+
+.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;}
+.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;}
+.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;}
+.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;}
+.columnWrap li {padding-left:10px; color:#585858; line-height:20px;}
+.columnWrap li:hover {background-color:#cccccc;}
+.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;}
+.sectionRow:hover {background-color:#cccccc; cursor:pointer;}
+.sectionContent {}
+.sectionContent li {padding-left:10px; line-height:20px;}
+.sectionContent li:hover {background-color:#cccccc;}
+.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;}
+.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;}
+.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;}
\ No newline at end of file
diff --git a/spec/factories/attachment_histories.rb b/spec/factories/attachment_histories.rb
new file mode 100644
index 000000000..3348cbd33
--- /dev/null
+++ b/spec/factories/attachment_histories.rb
@@ -0,0 +1,6 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :attachment_history do
+ end
+end
diff --git a/spec/models/attachment_history_spec.rb b/spec/models/attachment_history_spec.rb
new file mode 100644
index 000000000..58e38025d
--- /dev/null
+++ b/spec/models/attachment_history_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe AttachmentHistory, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end