Merge branch 'szzh' into develop
This commit is contained in:
commit
693c5878a5
|
@ -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
|
||||
|
|
|
@ -109,19 +109,19 @@ class UsersController < ApplicationController
|
|||
end
|
||||
if @user.course_messages
|
||||
if params[:type].nil?
|
||||
@user_course_messages = @user.course_messages
|
||||
@user_project_messges = @user.forge_messages
|
||||
@user_course_messages = @user.course_messages.reverse
|
||||
@user_project_messges = @user.forge_messages.reverse
|
||||
else
|
||||
case params[:type]
|
||||
when 'homework'
|
||||
@user_course_messages = @user.course_messages.select{|x| x.course_message_type == "HomeworkCommon"}
|
||||
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "HomeworkCommon"}
|
||||
#@user_course_messages = ForgeMessage.find_by_sql("select * from course_messages where user_id='#{@user.id}' and course_message_type = 'HomeworkCommon' order by created_at desc;")
|
||||
when 'message'
|
||||
@user_course_messages = @user.course_messages.select{|x| x.course_message_type == "Message"}
|
||||
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Message"}
|
||||
when 'news'
|
||||
@user_course_messages = @user.course_messages.select{|x| x.course_message_type == "News"}
|
||||
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "News"}
|
||||
when 'poll'
|
||||
@user_course_messages = @user.course_messages.select{|x| x.course_message_type == "Poll"}
|
||||
@user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Poll"}
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
来源
|
||||
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程ID)">
|
||||
来源(课程ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
|
@ -29,7 +29,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=0%>
|
||||
<% @count=@page*30%>
|
||||
<% for course in @course_ms -%>
|
||||
|
||||
<% @count=@count + 1 %>
|
||||
|
@ -51,10 +51,10 @@
|
|||
<%= format_date(course.created_on) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=course.subject %>'>
|
||||
<%= course.subject %>
|
||||
<%= link_to(course.subject, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%=course.replies_count %>
|
||||
<%= link_to(course.replies_count, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -62,5 +62,8 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_message_plural)) -%>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%@count=0 %>
|
||||
<%@count=@page*30 %>
|
||||
<% for homework in @homework do %>
|
||||
<% @count+=1 %>
|
||||
<tr>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=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))%>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=format_date(homework.end_time) %>
|
||||
|
@ -59,4 +59,8 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_user_homework)) -%>
|
||||
|
|
|
@ -1,7 +1,26 @@
|
|||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
|
||||
<h3>
|
||||
<%=l(:label_latest_login_user_list)%>
|
||||
</h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= l(:label_filter_plural) %>
|
||||
</legend>
|
||||
<label style="float:left">开始日期:</label>
|
||||
<%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
|
||||
<%= calendar_for('startdate')%><span style="float: left "> </span>
|
||||
<label style="float:left">结束日期:</label>
|
||||
<%= 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' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
|
@ -27,7 +46,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=0 %>
|
||||
<% @count=@page * 30 %>
|
||||
<% for user in @user do %>
|
||||
<tr>
|
||||
<% @count +=1 %>
|
||||
|
@ -70,4 +89,8 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_latest_login_user_list)) -%>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<th style="width: 50px;">
|
||||
类型
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
来源
|
||||
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程或用户ID)">
|
||||
来源(课程或用户ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
留言人
|
||||
|
@ -31,7 +31,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=0%>
|
||||
<% @count = @page * 30 %>
|
||||
<% for journal in @jour -%>
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
|
@ -49,20 +49,39 @@
|
|||
<td align="center">
|
||||
<%= journal.jour_id %>
|
||||
</td>
|
||||
<td align="center" title='<%= journal.try(:user).try(:realname)%>'>
|
||||
<%= link_to(journal.try(:user).try(:realname).truncate(6, omission: '...'), user_path(journal.user)) %>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<% if journal.try(:user).try(:realname) == ' '%><%= 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 %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(journal.created_on) %>
|
||||
</td>
|
||||
<td title='<%=journal.notes %>'>
|
||||
<%= journal.notes.truncate(15, omission: '...') %>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=journal.notes %>'>
|
||||
<%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 %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% 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 %>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -71,9 +90,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @jour_pages, @jour_count %>
|
||||
</ul>
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_leave_message_list)) -%>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
来源
|
||||
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(贴吧ID)">
|
||||
来源(贴吧ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
|
@ -29,7 +29,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=0%>
|
||||
<% @count=@page * 30%>
|
||||
<% for memo in @memo -%>
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
|
@ -50,20 +50,22 @@
|
|||
<%= format_date(memo.created_at) %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=memo.subject %>'>
|
||||
<%= memo.subject %>
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%=memo.replies_count %>
|
||||
<%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--<div class="pagination">
|
||||
<ul>
|
||||
<#%= pagination_links_full @memo_pages, @memo_count %>
|
||||
</ul>
|
||||
</div>-->
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_message_plural)) -%>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=0%>
|
||||
<% @count=@page * 30%>
|
||||
<% for news in @news -%>
|
||||
<% @count=@count + 1 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
|
@ -63,7 +63,7 @@
|
|||
<%= link_to(news.title, news_path(news)) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%=news.comments_count %>
|
||||
<%= link_to(news.comments_count, news_path(news)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
@ -71,4 +71,8 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_notification_list)) -%>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<th style="width: 30px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
来源
|
||||
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(项目ID)">
|
||||
来源(项目ID)
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
作者
|
||||
|
@ -29,7 +29,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @count=0%>
|
||||
<% @count=@page * 30 %>
|
||||
<% for project in @project_ms -%>
|
||||
|
||||
<% @count=@count + 1 %>
|
||||
|
@ -51,10 +51,10 @@
|
|||
<%= format_date(project.created_on) %>
|
||||
</td>
|
||||
<td title='<%=project.subject %>' style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name">
|
||||
<%= project.subject %>
|
||||
<%= link_to(project.subject, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%=project.replies_count %>
|
||||
<%= link_to(project.replies_count, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -63,4 +63,8 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_message_plural)) -%>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
|
||||
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
|
||||
<li class="homepageNewsType fl">发布通知</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to format_activity_title(" #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %></a></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||
</ul>
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue