diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 85dfba8cf..6989b0b4f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -624,7 +624,9 @@ class CoursesController < ApplicationController "show_course_journals_for_messages" => true } @date_to ||= Date.today + 1 - @date_from = @date_to - @days-1.years + # + @date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date + #@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, diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index e619ef843..9e41f467b 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -42,17 +42,30 @@ class FilesController < ApplicationController @isproject = false if params[:sort] - @oder = params[:sort].split(",")[0] - @order_by = @oder.split(":")[0] - @order_tyoe = @oder.split(":")[1] - if @order_by == "size" - @order_by = "filesize" + if params[:sort].include?":" + @orderBy = params[:sort].split(":")[0]; + @orderType = params[:sort].split(":")[1].split(",")[0]; + else + @orderBy = params[:sort].split(",")[0]; + @orderType = "asc"; end - @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@order_by} #{@order_tyoe}").find(@course.id)] - else - @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] end + if @orderBy=="size" + @orderBy="filesize" + elsif @orderBy=="field_file_dense" + @orderBy="is_public" + elsif @orderBy=="attach_type" + @orderBy="attachtype" + elsif @orderBy=="content_type" + @orderBy="attachtype" + end + + if @orderBy + @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)] + else + @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)] + end render :layout => 'base_courses' end end diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 8b713476e..deb590d1f 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -2,7 +2,7 @@

- <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> + <%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>

<% @events_by_day.keys.sort.reverse.each do |day| %> diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 46a6d03a1..63fdfc078 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -92,15 +92,15 @@