diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8ab6d5b62..99be166ad 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -416,11 +416,16 @@ class CoursesController < ApplicationController @date_from = @date_to - @days-1.years @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) # 决定显示所用用户或单个用户活动 - @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, - :with_subprojects => false, - :author => @author) - @activity.scope_select {|t| !has["show_#{t}"].nil?} - events = @activity.events(@date_from, @date_to) + #@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, + # :with_subprojects => false, + # :author => @author) + #@activity.scope_select {|t| !has["show_#{t}"].nil?} + #events = @activity.events(@date_from, @date_to) + + @activity = Activity.where("update_on between " +@date_from.to_s + " and " +@date_to.to_s ).order('id desc') + @activity_count = @activity.count + @activity_pages = Paginator.new @activity_count, pre_count, params['page'] + @activity = activity.offset(@activity_pages.offset).limit(@activity_pages.per_page).all @offset, @limit = api_offset_and_limit({:limit => 10}) @events_count = events.count diff --git a/app/models/course.rb b/app/models/course.rb index f282300bc..9fdff6a8c 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -25,6 +25,7 @@ class Course < ActiveRecord::Base has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy has_many :enabled_modules, :dependent => :delete_all has_many :boards, :dependent => :destroy, :order => "position ASC" + has_many :journals_for_messages, :as => :jour, :dependent => :destroy acts_as_taggable #acts_as_nested_set :order => 'name', :dependent => :destroy diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index f2ee85c1e..ac7023678 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -39,9 +39,6 @@ class JournalsForMessage < ActiveRecord::Base :timestamp => "#{self.table_name}.updated_on", :find_options => {:include => :project } - acts_as_activity_provider :author_key => :user_id, - :timestamp => "#{self.table_name}.updated_on", - :find_options => {:include => :course } has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index ea7d6c24f..c6f872d61 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -33,14 +33,14 @@
搜索 <%= form_tag( - course_attachments_autocomplete_path(:format => 'js'), + attachments_autocomplete_path(:format => 'js'), :remote => true, :method => :post) do %> <%= label_tag(:attach_search, "按关键字搜索:") %> <%= text_field_tag(:attach_search) %> <%#= submit_tag("Search") %> <% end -%> - <%= form_tag course_attach_relation_path(:format => 'js'), + <%= form_tag attach_relation_path(:format => 'js'), method: :post, remote: true, id: "relation_file_form", @@ -65,7 +65,7 @@ <% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
- <%= render :partial => 'show_all_attachment' %> + <%= render :partial => 'course_show_all_attachment' %>
<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_course_show_all_attachment.html.erb b/app/views/files/_course_show_all_attachment.html.erb new file mode 100644 index 000000000..083fd2f70 --- /dev/null +++ b/app/views/files/_course_show_all_attachment.html.erb @@ -0,0 +1,72 @@ +<% selAttachType =@attachtype %> +<% selContentType =@contenttype %> +<% attachmenttypes = @course.attachmenttypes %> +<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %> +<% edit_allowed = User.current.allowed_to?(:manage_files, @course) %> + + + + + + + + + + + <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %> + <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> + <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %> + <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %> + <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %> + <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> + <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> + + + + + <% @containers.each do |container| %> + <% next if container.attachments.empty? -%> + <% if container.is_a?(Version) -%> + + + + <% end -%> + <% container.attachments.each do |file| %> + "> + + + + + + + + + + + + + <% end -%> + <% reset_cycle %> + <% end -%> + + + + +
+ <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> +
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %><%= number_to_human_size(file.filesize) %> + <%= file.attachmentstype.typeName %> + + <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %> + + <%= file.show_suffix_type %><%= file.downloads %> + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> +
+
+ <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
+
+ +
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 3bbc960a4..639d99974 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -58,17 +58,7 @@ } } - function attachmenttypes_searchex(value) { - $.ajax({ - url: '<%=getattachtype_project_files_path(project_id: @project)%>', - type: "POST", - data: { - type: encodeURIComponent(value), - contentType: $('#attach_sufix_browse').val() - } - }).complete(eval_ajax); - } function course_attachmenttypes_searchex(value) { $.ajax({