commit
9138f46301
@ -0,0 +1,7 @@
|
|||||||
|
class CourseActivity < ActiveRecord::Base
|
||||||
|
attr_accessible :user_id, :course_act_id,:course_act_type,:course_id
|
||||||
|
# 虚拟关联
|
||||||
|
belongs_to :course_act ,:polymorphic => true
|
||||||
|
belongs_to :course
|
||||||
|
belongs_to :user
|
||||||
|
end
|
@ -0,0 +1,12 @@
|
|||||||
|
class CourseMessage < ActiveRecord::Base
|
||||||
|
attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed
|
||||||
|
|
||||||
|
# 多态 虚拟关联
|
||||||
|
belongs_to :course_message ,:polymorphic => true
|
||||||
|
belongs_to :course
|
||||||
|
belongs_to :user
|
||||||
|
validates :user_id,presence: true
|
||||||
|
validates :course_id,presence: true
|
||||||
|
validates :course_message_id,presence: true
|
||||||
|
validates :course_message_type, presence: true
|
||||||
|
end
|
@ -0,0 +1,20 @@
|
|||||||
|
class ForgeMessage < ActiveRecord::Base
|
||||||
|
# 公共表中活动类型,命名规则:TYPE_OF_{类名}_ACT
|
||||||
|
TYPE_OF_ISSUE_ACT = "Issue"
|
||||||
|
TYPE_OF_MESSAGE_ACT = "Message"
|
||||||
|
TYPE_OF_ATTACHMENT_ACT = "Attachment"
|
||||||
|
TYPE_OF_DOCUMENT_ACT = "Document"
|
||||||
|
TYPE_OF_JOURNAL_ACT = "Journal"
|
||||||
|
TYPE_OF_WIKI_ACT = "Wiki"
|
||||||
|
TYPE_OF_NEWS_ACT = "News"
|
||||||
|
|
||||||
|
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed
|
||||||
|
|
||||||
|
belongs_to :forge_message ,:polymorphic => true
|
||||||
|
belongs_to :project
|
||||||
|
belongs_to :user
|
||||||
|
validates :user_id,presence: true
|
||||||
|
validates :project_id,presence: true
|
||||||
|
validates :forge_message_id,presence: true
|
||||||
|
validates :forge_message_type, presence: true
|
||||||
|
end
|
@ -0,0 +1,8 @@
|
|||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><%= link_to l(:label_forum), {:action => 'messages_list'}, class: "#{current_page?(messages_list_path)? 'selected' : nil }" %></li>
|
||||||
|
<li><%= link_to l(:label_borad_course), {:action => 'course_messages'}, class: "#{current_page?(course_messages_path)? 'selected' : nil }" %></li>
|
||||||
|
<li><%= link_to l(:label_borad_project), {:action => 'project_messages'}, class: "#{current_page?(project_messages_path)? 'selected' : nil }" %></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
@ -0,0 +1,69 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_message_plural)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= render 'tab_messages' %>
|
||||||
|
<h4><%=l(:label_borad_course) %></h4>
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程ID)">
|
||||||
|
来源(课程ID)
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=@page*30%>
|
||||||
|
<% for course in @course_ms -%>
|
||||||
|
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= Board.where('id=?',course.board_id).first.course_id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if course.try(:author).try(:realname) == ' '%><%= course.try(:author)%><% else %><%=course.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if course.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(course.try(:author), user_path(course.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(course.try(:author).try(:realname), user_path(course.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(course.created_on) %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=course.subject %>'>
|
||||||
|
<%= link_to(course.subject, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= link_to(course.replies_count, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_message_plural)) -%>
|
@ -0,0 +1,66 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_user_homework)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
作业名称
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
课程名称
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
提交作品数
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
提交截止日期
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%@count=@page*30 %>
|
||||||
|
<% for homework in @homework do %>
|
||||||
|
<% @count+=1 %>
|
||||||
|
<tr>
|
||||||
|
<td align="center">
|
||||||
|
<%=@count %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.name%>'>
|
||||||
|
<%=link_to(homework.name, student_work_index_path(:homework => homework.id))%>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.course.name%>'>
|
||||||
|
<%= link_to(homework.course.name, course_path(homework.course.id)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
|
||||||
|
<% if homework.try(:user).try(:realname) == ' '%>
|
||||||
|
<%= link_to(homework.try(:user), user_path(homework.user_id)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=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) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_user_homework)) -%>
|
@ -0,0 +1,96 @@
|
|||||||
|
<%= 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>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
登录时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
用户id
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户姓名
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户昵称
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户身份
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=@page * 30 %>
|
||||||
|
<% for user in @user do %>
|
||||||
|
<tr>
|
||||||
|
<% @count +=1 %>
|
||||||
|
<td align="center">
|
||||||
|
<%=@count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=format_date(user.last_login_on) %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=user.id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if user.try(:realname) == ' '%><%= user.login%><% else %><%=user.try(:realname) %><% end %>'>
|
||||||
|
<% if user.try(:realname) == ' '%>
|
||||||
|
<%= link_to(user.login, user_path(user)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(user.try(:realname), user_path(user)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=link_to(user.login, user_path(user)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<% case user.user_extensions.identity %>
|
||||||
|
<% when 0 %>
|
||||||
|
<%='老师' %>
|
||||||
|
<% when 1 %>
|
||||||
|
<%='学生' %>
|
||||||
|
<% when 2 %>
|
||||||
|
<%='企业' %>
|
||||||
|
<% when 3 %>
|
||||||
|
<%='开发者' %>
|
||||||
|
<% else %>
|
||||||
|
<%='未知身份' %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</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)) -%>
|
@ -0,0 +1,96 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_leave_message_list)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
类型
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程或用户ID)">
|
||||||
|
来源(课程或用户ID)
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
留言人
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
留言时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
留言内容
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count = @page * 30 %>
|
||||||
|
<% for journal in @jour -%>
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%case journal.jour_type %>
|
||||||
|
<% when 'Principal' %>
|
||||||
|
<%='用户主页' %>
|
||||||
|
<% when 'Course' %>
|
||||||
|
<%='课程' %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= journal.jour_id %>
|
||||||
|
</td>
|
||||||
|
<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 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) %>
|
||||||
|
<%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 %>
|
||||||
|
<%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>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_leave_message_list)) -%>
|
@ -0,0 +1,71 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_message_plural)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= render 'tab_messages' %>
|
||||||
|
<h4><%=l(:label_forum) %></h4>
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(贴吧ID)">
|
||||||
|
来源(贴吧ID)
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=@page * 30%>
|
||||||
|
<% for memo in @memo -%>
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= memo.forum_id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if memo.try(:author).try(:realname) == ' '%><%= memo.try(:author)%><% else %><%=memo.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if memo.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(memo.try(:author), user_path(memo.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(memo.try(:author).try(:realname), user_path(memo.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(memo.created_at) %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=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">
|
||||||
|
<%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_message_plural)) -%>
|
@ -0,0 +1,78 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_notification_list)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
课程id
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
课程名称
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
主讲老师
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=@page * 30%>
|
||||||
|
<% for news in @news -%>
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=news.course_id %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.name %>">
|
||||||
|
<%=link_to(news.course.name, course_path(news.course)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.try(:teacher).try(:realname) %>">
|
||||||
|
<%=link_to(news.course.try(:teacher).try(:realname), user_path(news.course.teacher)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if news.try(:author).try(:realname) == ' '%><%= news.try(:author)%><% else %><%=news.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if news.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(news.try(:author), user_path(news.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(news.try(:author).try(:realname), user_path(news.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(news.created_on) %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=news.title %>'>
|
||||||
|
<%= link_to(news.title, news_path(news)) %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= link_to(news.comments_count, news_path(news)) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_notification_list)) -%>
|
@ -0,0 +1,70 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_message_plural)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= render 'tab_messages' %>
|
||||||
|
<h4><%=l(:label_borad_project) %></h4>
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(项目ID)">
|
||||||
|
来源(项目ID)
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=@page * 30 %>
|
||||||
|
<% for project in @project_ms -%>
|
||||||
|
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= Board.where('id=?',project.board_id).first.project_id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if project.try(:author).try(:realname) == ' '%><%= project.try(:author)%><% else %><%=project.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if project.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(project.try(:author), user_path(project.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(project.try(:author).try(:realname), user_path(project.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(project.created_on) %>
|
||||||
|
</td>
|
||||||
|
<td title='<%=project.subject %>' style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name">
|
||||||
|
<%= link_to(project.subject, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= link_to(project.replies_count, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_message_plural)) -%>
|
@ -0,0 +1,79 @@
|
|||||||
|
<div id="RSide" class="fl">
|
||||||
|
<div class="homepageRight">
|
||||||
|
<div class="resources">
|
||||||
|
<div class="resourcesBanner">
|
||||||
|
<div class="bannerName">消息</div>
|
||||||
|
<ul class="resourcesSelect">
|
||||||
|
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||||
|
<ul class="newsType">
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "全部",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %></a></li>
|
||||||
|
<!--<li><a href="javascript:void(0);" class="resourcesGrey">@我</a></li>-->
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %></a></li>
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'message'} %></a></li>
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'news'} %></a></li>
|
||||||
|
<!--<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>-->
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<% if !@user_course_messages.blank? %>
|
||||||
|
<% @user_course_messages.each do |ucm| %>
|
||||||
|
<% if ucm.course_message_type == "News" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<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">
|
||||||
|
<%= 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>
|
||||||
|
<% end %>
|
||||||
|
<% if ucm.course_message_type == "HomeworkCommon" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
|
||||||
|
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
|
||||||
|
<li class="homepageNewsType fl">发布作业</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id) %></a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% if ucm.course_message_type == "Poll" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
|
||||||
|
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
|
||||||
|
<li class="homepageNewsType fl">发布问卷</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id) %></a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% if ucm.course_message_type == "Message" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<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>
|
||||||
|
<% if ucm.course_message.parent_id.nil? %>
|
||||||
|
<li class="homepageNewsType fl">发布帖子</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %></a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||||
|
<% else %>
|
||||||
|
<li class="homepageNewsType fl">回复帖子</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %> </a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<div class="flash notice">暂无消息!</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,8 @@
|
|||||||
|
class AddCreatedAtToActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :activities, :created_at, :timestamp
|
||||||
|
end
|
||||||
|
def end
|
||||||
|
remove_column :activities, :created_at
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,21 @@
|
|||||||
|
class UpdateActivitiesData < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = Activity.all.count / 20 + 1
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
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
|
||||||
|
elsif type=='Contestnotification' || type=='HomeworkCommon' || type=='Poll'
|
||||||
|
activity.created_at = activity.act.created_at if activity.act
|
||||||
|
end
|
||||||
|
activity.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
class AddCourseActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :course_activities do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :course_id
|
||||||
|
t.integer :course_act_id
|
||||||
|
t.string :course_act_type
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :course_activities
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,40 @@
|
|||||||
|
#encoding=UTF-8
|
||||||
|
class CourseActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Course.all.each do |course|
|
||||||
|
transaction do
|
||||||
|
course.course_acts << CourseActivity.new(:user_id => course.tea_id,:course_id => course.id)
|
||||||
|
#作业
|
||||||
|
course.homework_commons.each do |homework_common|
|
||||||
|
homework_common.course_acts << CourseActivity.new(:user_id => homework_common.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#通知
|
||||||
|
course.news.each do |new|
|
||||||
|
new.course_acts << CourseActivity.new(:user_id => new.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#资源
|
||||||
|
course.attachments.each do |attachment|
|
||||||
|
attachment.course_acts << CourseActivity.new(:user_id => attachment.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#讨论区
|
||||||
|
if course.boards.first
|
||||||
|
course.boards.first.messages.each do |message|
|
||||||
|
message.course_acts << CourseActivity.new(:user_id => message.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#留言
|
||||||
|
course.journals_for_messages.each do |jour|
|
||||||
|
jour.course_acts << CourseActivity.new(:user_id => jour.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#问卷
|
||||||
|
Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll|
|
||||||
|
poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
CourseActivity.destroy_all
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
class CreateForgeMessages < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :forge_messages do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :project_id
|
||||||
|
t.integer :forge_message_id
|
||||||
|
t.string :forge_message_type
|
||||||
|
t.integer :viewed
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
class CreateCourseMessages < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :course_messages do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :course_id
|
||||||
|
t.integer :course_message_id
|
||||||
|
t.string :course_message_type
|
||||||
|
t.integer :viewed
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
class ChangeAttachmentTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Attachment.where("container_type = 'Course'").each do |attachment|
|
||||||
|
if attachment.container && attachment.container.created_at.to_i > attachment.created_on.to_i
|
||||||
|
attachment.created_on = attachment.container.created_at + 3600 * 24
|
||||||
|
attachment.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,22 @@
|
|||||||
|
class UpdateCourseActivityTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = CourseActivity.all.count / 10 + 1
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
CourseActivity.page(i).per(10).each do |activity|
|
||||||
|
if activity.course_act
|
||||||
|
if activity.course_act.respond_to?("created_at")
|
||||||
|
activity.created_at = activity.course_act.created_at
|
||||||
|
elsif activity.course_act.respond_to?("created_on")
|
||||||
|
activity.created_at = activity.course_act.created_on
|
||||||
|
end
|
||||||
|
activity.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,9 @@
|
|||||||
|
class AddSystemScoreToStudentWork < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :student_works,:system_score,:integer
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :student_works,:system_score
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,10 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :course_message do
|
||||||
|
user_id 1
|
||||||
|
course_id 1
|
||||||
|
course_message_id 1
|
||||||
|
course_message_type "MyString"
|
||||||
|
viewed 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,10 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :forge_message do
|
||||||
|
user_id 1
|
||||||
|
project_id 1
|
||||||
|
forge_message_id 1
|
||||||
|
forge_message_type "MyString"
|
||||||
|
viewed 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe CourseMessage, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ForgeMessage, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue