diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index a44b58789..25536615a 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -395,4 +395,74 @@ class AdminController < ApplicationController
end
+ #留言列表
+ 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
+
+ respond_to do |format|
+ format.html
+ end
+ end
+
+ #帖子
+ 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
+
+ respond_to do |format|
+ format.html
+ end
+ end
+
+ #课程讨论区的帖子
+ 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')
+ 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')
+ end
+
+ #通知
+ def notices
+ @news = News.where('course_id is not NULL').order('created_on desc')
+ end
+
+ #最近登录用户列表
+ def latest_login_users
+ @user = User.order('last_login_on desc')
+ end
+
+ #作业
+ def homework
+ @homework = HomeworkCommon.order('end_time desc')
+ end
+
end
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 21f781a1a..87c1e288b 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -19,28 +19,28 @@ class HomeworkCommonController < ApplicationController
end
def new
- # @homework_type = "1"
- #
- # @homework = HomeworkCommon.new
- # @homework.safe_attributes = params[:homework_common]
- # @homework.late_penalty = 2
- # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
- #
- # if @homework_type == "1"
- # #匿评作业相关属性
- # @homework_detail_manual = HomeworkDetailManual.new
- # @homework_detail_manual.ta_proportion = 0.6
- # @homework_detail_manual.absence_penalty = 2
- # @homework_detail_manual.evaluation_num = 3
- # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
- # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.homework_detail_manual = @homework_detail_manual
- # elsif @homework_type == "2"
- # #编程作业相关属性
- # @homework_detail_programing = HomeworkDetailPrograming.new
- # @homework.homework_detail_programing = @homework_detail_programing
- # end
+ @homework_type = "1"
+
+ @homework = HomeworkCommon.new
+ @homework.safe_attributes = params[:homework_common]
+ @homework.late_penalty = 2
+ @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.publish_time = Time.now.strftime('%Y-%m-%d')
+
+ if @homework_type == "1"
+ #匿评作业相关属性
+ @homework_detail_manual = HomeworkDetailManual.new
+ @homework_detail_manual.ta_proportion = 0.6
+ @homework_detail_manual.absence_penalty = 2
+ @homework_detail_manual.evaluation_num = 3
+ @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
+ @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.homework_detail_manual = @homework_detail_manual
+ elsif @homework_type == "2"
+ #编程作业相关属性
+ @homework_detail_programing = HomeworkDetailPrograming.new
+ @homework.homework_detail_programing = @homework_detail_programing
+ end
respond_to do |format|
format.html
end
diff --git a/app/views/admin/_tab_messages.erb b/app/views/admin/_tab_messages.erb
new file mode 100644
index 000000000..ec04246ba
--- /dev/null
+++ b/app/views/admin/_tab_messages.erb
@@ -0,0 +1,8 @@
+
+
+ - <%= link_to l(:label_forum), {:action => 'messages_list'}, class: "#{current_page?(messages_list_path)? 'selected' : nil }" %>
+ - <%= link_to l(:label_borad_course), {:action => 'course_messages'}, class: "#{current_page?(course_messages_path)? 'selected' : nil }" %>
+ - <%= link_to l(:label_borad_project), {:action => 'project_messages'}, class: "#{current_page?(project_messages_path)? 'selected' : nil }" %>
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/course_messages.html.erb b/app/views/admin/course_messages.html.erb
new file mode 100644
index 000000000..8564d13dc
--- /dev/null
+++ b/app/views/admin/course_messages.html.erb
@@ -0,0 +1,66 @@
+
+ <%=l(:label_message_plural)%>
+
+
+<%= render 'tab_messages' %>
+<%=l(:label_borad_course) %>
+
+
+<% html_title(l(:label_message_plural)) -%>
diff --git a/app/views/admin/homework.html.erb b/app/views/admin/homework.html.erb
new file mode 100644
index 000000000..360ca4e39
--- /dev/null
+++ b/app/views/admin/homework.html.erb
@@ -0,0 +1,62 @@
+
+ <%=l(:label_user_homework)%>
+
+
+
+
+<% 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
new file mode 100644
index 000000000..dc35daec8
--- /dev/null
+++ b/app/views/admin/latest_login_users.html.erb
@@ -0,0 +1,73 @@
+
+ <%=l(:label_latest_login_user_list)%>
+
+
+
+
+<% 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
new file mode 100644
index 000000000..975c60b15
--- /dev/null
+++ b/app/views/admin/leave_messages.html.erb
@@ -0,0 +1,79 @@
+
+ <%=l(:label_leave_message_list)%>
+
+
+
+
+
+
+<% 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
new file mode 100644
index 000000000..77cdbbc69
--- /dev/null
+++ b/app/views/admin/messages_list.html.erb
@@ -0,0 +1,69 @@
+
+ <%=l(:label_message_plural)%>
+
+
+<%= render 'tab_messages' %>
+<%=l(:label_forum) %>
+
+
+
+<% html_title(l(:label_message_plural)) -%>
diff --git a/app/views/admin/notices.html.erb b/app/views/admin/notices.html.erb
new file mode 100644
index 000000000..56f212720
--- /dev/null
+++ b/app/views/admin/notices.html.erb
@@ -0,0 +1,74 @@
+
+ <%=l(:label_notification_list)%>
+
+
+
+
+<% html_title(l(:label_notification_list)) -%>
diff --git a/app/views/admin/project_messages.html.erb b/app/views/admin/project_messages.html.erb
new file mode 100644
index 000000000..af2978422
--- /dev/null
+++ b/app/views/admin/project_messages.html.erb
@@ -0,0 +1,66 @@
+
+ <%=l(:label_message_plural)%>
+
+
+<%= render 'tab_messages' %>
+<%=l(:label_borad_project) %>
+
+
+<% html_title(l(:label_message_plural)) -%>
diff --git a/app/views/boards/_form.html.erb b/app/views/boards/_form.html.erb
index 47ae0672d..a4f58dcc3 100644
--- a/app/views/boards/_form.html.erb
+++ b/app/views/boards/_form.html.erb
@@ -1,7 +1,7 @@
<%= error_messages_for @board %>
-
+
<%= f.text_field :name, :required => true %>
diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb
index 5520f526d..609294161 100644
--- a/app/views/boards/show.html.erb
+++ b/app/views/boards/show.html.erb
@@ -1,12 +1,5 @@