From 0ba9cfe5ddfcbe99509581cae356bd41ed6e4d16 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 15 Aug 2015 19:47:24 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8F=90=E5=8D=87=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20150811010817_update_activities_data.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20150811010817_update_activities_data.rb b/db/migrate/20150811010817_update_activities_data.rb index de4a080f2..7ed19a607 100644 --- a/db/migrate/20150811010817_update_activities_data.rb +++ b/db/migrate/20150811010817_update_activities_data.rb @@ -1,9 +1,9 @@ class UpdateActivitiesData < ActiveRecord::Migration def up - count = Activity.all.count / 10 + 1 + count = Activity.all.count / 20 + 1 transaction do for i in 1 ... count do i - Activity.all.each do |activity| + Activity.page(i).per(20).each do |activity| type = activity.act_type if type=='Contest' || type=='Message' || type=='News'|| type=='Journal'|| type=='Issue'|| type=='Principal'||type=='JournalsForMessage' activity.created_at = activity.act.created_on if activity.act From c97ec1a3702c2ea1001b5c2b6da30f81d2cbed37 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 15 Aug 2015 19:47:50 +0800 Subject: [PATCH 2/4] 111 --- db/schema.rb | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index db9b9ff9b..8d78a9ca0 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 => 20150810064247) do +ActiveRecord::Schema.define(:version => 20150815030833) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -325,6 +325,15 @@ ActiveRecord::Schema.define(:version => 20150810064247) do t.datetime "updated_on", :null => false end + create_table "course_activities", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_act_id" + t.string "course_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "course_attachments", :force => true do |t| t.string "filename" t.string "disk_filename" @@ -357,6 +366,16 @@ ActiveRecord::Schema.define(:version => 20150810064247) do t.datetime "updated_at", :null => false end + create_table "course_messages", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_message_id" + t.string "course_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "course_statuses", :force => true do |t| t.integer "changesets_count" t.integer "watchers_count" @@ -455,6 +474,13 @@ ActiveRecord::Schema.define(:version => 20150810064247) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -536,6 +562,16 @@ ActiveRecord::Schema.define(:version => 20150810064247) do add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + create_table "forge_messages", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_message_id" + t.string "forge_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -857,7 +893,6 @@ ActiveRecord::Schema.define(:version => 20150810064247) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" - t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id" @@ -1262,6 +1297,7 @@ ActiveRecord::Schema.define(:version => 20150810064247) do t.datetime "updated_at", :null => false t.integer "late_penalty", :default => 0 t.integer "absence_penalty", :default => 0 + t.integer "system_score" end create_table "student_works_evaluation_distributions", :force => true do |t| From 27ff5471ec0aaeba36739572b4468766b4dbfc76 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 18 Aug 2015 14:40:12 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=88=86=E9=A1=B5=E3=80=81=E6=B7=BB=E5=8A=A0=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 66 +++++++++++---------- app/views/admin/course_messages.html.erb | 9 ++- app/views/admin/homework.html.erb | 8 ++- app/views/admin/latest_login_users.html.erb | 25 +++++++- app/views/admin/leave_messages.html.erb | 37 ++++++++---- app/views/admin/messages_list.html.erb | 14 ++--- app/views/admin/notices.html.erb | 8 ++- app/views/admin/project_messages.html.erb | 10 +++- db/schema.rb | 8 +-- 9 files changed, 118 insertions(+), 67 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 25536615a..1624008f2 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -397,19 +397,10 @@ class AdminController < ApplicationController #留言列表 def leave_messages - @jour = JournalsForMessage.where("jour_type = 'Principal' or jour_type = 'Course'").reorder('created_on desc') - case params[:format] - when 'xml', 'json' - @offset, @limit = api_offset_and_limit({:limit => 30}) - else - @limit = 30#per_page_option - end - - @jour_count = @jour.count - @jour_pages = Paginator.new @jour_count, @limit, params['page'] - @offset ||= @jour_pages.offset - @jour = @jour.limit(@limit).offset(@offset).all - + @jour = JournalsForMessage.find_by_sql("SELECT * FROM journals_for_messages AS j1 + WHERE j1.jour_type IN ('Course','Principal') AND (j1.m_parent_id IS NULL OR (j1.m_parent_id IN (SELECT id FROM journals_for_messages WHERE jour_type IN ('Course','Principal')))) order by created_on desc") + @jour = paginateHelper @jour,30 + @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html end @@ -418,21 +409,8 @@ class AdminController < ApplicationController #帖子 def messages_list @memo = Memo.reorder("created_at desc") - -=begin - case params[:format] - when 'xml', 'json' - @offset, @limit = api_offset_and_limit({:limit => 30}) - else - @limit = 30#per_page_option - end - - @memo_count = @memo.count - @memo_pages = Paginator.new @memo_count, @limit, params['page'] - @offset ||= @memo_pages.offset - @memo = @memo.limit(@limit).offset(@offset).all -=end - + @memo = paginateHelper @memo,30 + @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html end @@ -440,29 +418,55 @@ class AdminController < ApplicationController #课程讨论区的帖子 def course_messages - #@boards=Board.where('course_id is NULL') - #@course_ms = Message.reorder('created_on desc') @course_ms=Message.joins("join boards on messages.board_id=boards.id where boards.course_id is not NULL").reorder('created_on desc') + @course_ms = paginateHelper @course_ms,30 + @page = (params['page'] || 1).to_i - 1 + respond_to do |format| + format.html + end end #项目讨论区的帖子 def project_messages @project_ms=Message.joins("join boards on messages.board_id=boards.id where boards.project_id != -1").reorder('created_on desc') + @project_ms = paginateHelper @project_ms,30 + @page = (params['page'] || 1).to_i - 1 + respond_to do |format| + format.html + end end #通知 def notices @news = News.where('course_id is not NULL').order('created_on desc') + @news = paginateHelper @news,30 + @page = (params['page'] || 1).to_i - 1 + respond_to do |format| + format.html + end end #最近登录用户列表 def latest_login_users - @user = User.order('last_login_on desc') + scope = User.order('last_login_on desc') + scope = scope.where("last_login_on>= '#{params[:startdate]} 00:00:00'") if params[:startdate].present? + scope =scope.where("last_login_on <= '#{params[:enddate]} 23:59:59'") if params[:enddate].present? + @user = scope + @user = paginateHelper @user,30 + @page = (params['page'] || 1).to_i - 1 + respond_to do |format| + format.html + end end #作业 def homework @homework = HomeworkCommon.order('end_time desc') + @homework = paginateHelper @homework,30 + @page = (params['page'] || 1).to_i - 1 + respond_to do |format| + format.html + end end end diff --git a/app/views/admin/course_messages.html.erb b/app/views/admin/course_messages.html.erb index 8564d13dc..3db0a3e11 100644 --- a/app/views/admin/course_messages.html.erb +++ b/app/views/admin/course_messages.html.erb @@ -29,7 +29,7 @@ - <% @count=0%> + <% @count=@page*30%> <% for course in @course_ms -%> <% @count=@count + 1 %> @@ -51,10 +51,10 @@ <%= format_date(course.created_on) %> - <%= course.subject %> + <%= link_to(course.subject, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %> - <%=course.replies_count %> + <%= link_to(course.replies_count, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %> @@ -62,5 +62,8 @@ + <% html_title(l(:label_message_plural)) -%> diff --git a/app/views/admin/homework.html.erb b/app/views/admin/homework.html.erb index 360ca4e39..7260d68ff 100644 --- a/app/views/admin/homework.html.erb +++ b/app/views/admin/homework.html.erb @@ -27,7 +27,7 @@ - <%@count=0 %> + <%@count=@page*30 %> <% for homework in @homework do %> <% @count+=1 %> @@ -48,7 +48,7 @@ <% end %> - <%=StudentWork.where('homework_common_id=?',homework.id).count %> + <%=link_to(StudentWork.where('homework_common_id=?',homework.id).count, student_work_index_path(:homework => homework.id))%> <%=format_date(homework.end_time) %> @@ -59,4 +59,8 @@ + + <% html_title(l(:label_user_homework)) -%> diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index dc35daec8..838cc0dcb 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -1,7 +1,26 @@ +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>

<%=l(:label_latest_login_user_list)%>

+<%= form_tag({}, :method => :get) do %> +
+ + <%= l(:label_filter_plural) %> + + + <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange =>"regexDeadLine();", :style=>"float:left"%> + <%= calendar_for('startdate')%> + + <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"regexDeadLine();", :style=>"float:left"%> + <%= calendar_for('enddate')%>   + <%= submit_tag l(:button_apply), :class => "small", :name => nil %> + <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_users'}, :class => 'icon icon-reload' %> +
+<% end %> +  + +
@@ -27,7 +46,7 @@ - <% @count=0 %> + <% @count=@page * 30 %> <% for user in @user do %> <% @count +=1 %> @@ -70,4 +89,8 @@
+ + <% html_title(l(:label_latest_login_user_list)) -%> diff --git a/app/views/admin/leave_messages.html.erb b/app/views/admin/leave_messages.html.erb index 975c60b15..360e9b864 100644 --- a/app/views/admin/leave_messages.html.erb +++ b/app/views/admin/leave_messages.html.erb @@ -31,7 +31,7 @@ - <% @count=0%> + <% @count = @page * 30 %> <% for journal in @jour -%> <% @count=@count + 1 %> "> @@ -49,20 +49,39 @@ <%= journal.jour_id %> - - <%= link_to(journal.try(:user).try(:realname).truncate(6, omission: '...'), user_path(journal.user)) %> + <%= journal.try(:user)%><% else %><%=journal.try(:user).try(:realname) %><% end %>'> + <% if journal.try(:user).try(:realname) == ' '%> + <%= link_to(journal.try(:user), user_path(journal.user)) %> + <% else %> + <%= link_to(journal.try(:user).try(:realname), user_path(journal.user)) %> + <% end %> <%= format_date(journal.created_on) %> - - <%= journal.notes.truncate(15, omission: '...') %> + + <%case journal.jour_type %> + <% when 'Principal' %> + <%= link_to(journal.notes.html_safe, feedback_path(journal.jour_id)) %> + <% when 'Course' %> + <%= link_to(journal.notes.html_safe, course_feedback_path(journal.jour_id)) %> + <% end %> <% if(journal.m_reply_count) %> - <%=journal.m_reply_count%> + <%case journal.jour_type %> + <% when 'Principal' %> + <%= link_to(journal.m_reply_count, feedback_path(journal.jour_id)) %> + <% when 'Course' %> + <%= link_to(journal.m_reply_count, course_feedback_path(journal.jour_id)) %> + <% end %> <% else %> - <%=0 %> + <%case journal.jour_type %> + <% when 'Principal' %> + <%= link_to(0, feedback_path(journal.jour_id)) %> + <% when 'Course' %> + <%= link_to(0, course_feedback_path(journal.jour_id)) %> + <% end %> <% end %> @@ -71,9 +90,7 @@ <% html_title(l(:label_leave_message_list)) -%> diff --git a/app/views/admin/messages_list.html.erb b/app/views/admin/messages_list.html.erb index 77cdbbc69..e0c84279d 100644 --- a/app/views/admin/messages_list.html.erb +++ b/app/views/admin/messages_list.html.erb @@ -29,7 +29,7 @@ - <% @count=0%> + <% @count=@page * 30%> <% for memo in @memo -%> <% @count=@count + 1 %> "> @@ -50,20 +50,18 @@ <%= format_date(memo.created_at) %> - <%= memo.subject %> + <%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %> - <%=memo.replies_count %> + <%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %> <% end %> - + <% html_title(l(:label_message_plural)) -%> diff --git a/app/views/admin/notices.html.erb b/app/views/admin/notices.html.erb index 56f212720..f03a7b97a 100644 --- a/app/views/admin/notices.html.erb +++ b/app/views/admin/notices.html.erb @@ -33,7 +33,7 @@ - <% @count=0%> + <% @count=@page * 30%> <% for news in @news -%> <% @count=@count + 1 %> "> @@ -63,7 +63,7 @@ <%= link_to(news.title, news_path(news)) %> - <%=news.comments_count %> + <%= link_to(news.comments_count, news_path(news)) %> <% end %> @@ -71,4 +71,8 @@ + + <% html_title(l(:label_notification_list)) -%> diff --git a/app/views/admin/project_messages.html.erb b/app/views/admin/project_messages.html.erb index af2978422..dc44a7cba 100644 --- a/app/views/admin/project_messages.html.erb +++ b/app/views/admin/project_messages.html.erb @@ -29,7 +29,7 @@ - <% @count=0%> + <% @count=@page * 30 %> <% for project in @project_ms -%> <% @count=@count + 1 %> @@ -51,10 +51,10 @@ <%= format_date(project.created_on) %> - <%= project.subject %> + <%= link_to(project.subject, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %> - <%=project.replies_count %> + <%= link_to(project.replies_count, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %> @@ -63,4 +63,8 @@ + + <% html_title(l(:label_message_plural)) -%> diff --git a/db/schema.rb b/db/schema.rb index 8d78a9ca0..841bcc7e9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -474,13 +474,6 @@ ActiveRecord::Schema.define(:version => 20150815030833) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -893,6 +886,7 @@ ActiveRecord::Schema.define(:version => 20150815030833) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id" From 652f5fa6e130a1d316530557803a4716fb1a7672 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 18 Aug 2015 17:00:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E7=95=99=E8=A8=80=E5=88=97=E8=A1=A8=E3=80=81?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E3=80=81=E6=9C=80=E8=BF=91=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E7=9A=84=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/course_messages.html.erb | 4 ++-- app/views/admin/latest_login_users.html.erb | 6 +++--- app/views/admin/leave_messages.html.erb | 4 ++-- app/views/admin/messages_list.html.erb | 10 +++++++--- app/views/admin/project_messages.html.erb | 4 ++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/views/admin/course_messages.html.erb b/app/views/admin/course_messages.html.erb index 3db0a3e11..c9e69357f 100644 --- a/app/views/admin/course_messages.html.erb +++ b/app/views/admin/course_messages.html.erb @@ -11,8 +11,8 @@ 序号 - - 来源 + + 来源(课程ID) 作者 diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index 838cc0dcb..89514726a 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -9,10 +9,10 @@ <%= l(:label_filter_plural) %> - <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange =>"regexDeadLine();", :style=>"float:left"%> - <%= calendar_for('startdate')%> + <%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%> + <%= calendar_for('startdate')%>    - <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"regexDeadLine();", :style=>"float:left"%> + <%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%> <%= calendar_for('enddate')%>   <%= submit_tag l(:button_apply), :class => "small", :name => nil %> <%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_users'}, :class => 'icon icon-reload' %> diff --git a/app/views/admin/leave_messages.html.erb b/app/views/admin/leave_messages.html.erb index 360e9b864..dee8b7443 100644 --- a/app/views/admin/leave_messages.html.erb +++ b/app/views/admin/leave_messages.html.erb @@ -13,8 +13,8 @@ 类型 - - 来源 + + 来源(课程或用户ID) 留言人 diff --git a/app/views/admin/messages_list.html.erb b/app/views/admin/messages_list.html.erb index e0c84279d..ca84baa24 100644 --- a/app/views/admin/messages_list.html.erb +++ b/app/views/admin/messages_list.html.erb @@ -11,8 +11,8 @@ 序号 - - 来源 + + 来源(贴吧ID) 作者 @@ -50,7 +50,11 @@ <%= format_date(memo.created_at) %> - <%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %> + <% if memo.parent_id.nil? || memo.subject.starts_with?('RE:')%> + <%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %> + <% else %> + <%= link_to("RE:"+memo.subject, forum_memo_path(memo.forum, memo)) %> + <% end %> <%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %> diff --git a/app/views/admin/project_messages.html.erb b/app/views/admin/project_messages.html.erb index dc44a7cba..a5639eba7 100644 --- a/app/views/admin/project_messages.html.erb +++ b/app/views/admin/project_messages.html.erb @@ -11,8 +11,8 @@ 序号 - - 来源 + + 来源(项目ID) 作者