Conflicts:
	db/schema.rb
This commit is contained in:
z9hang 2014-06-26 15:15:46 +08:00
commit 2501f31ef1
13 changed files with 139 additions and 102 deletions

View File

@ -5,6 +5,10 @@ class CoursesController < ApplicationController
helper :members
helper :words
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework
menu_item l(:label_sort_by_time), :only => :index
menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index

View File

@ -34,7 +34,7 @@ class Course < ActiveRecord::Base
:delete_permission => :manage_files
validates_presence_of :password, :term
validates_format_of :class_period, :message => "class period can only digital!", :with =>/^[1-9]\d*$/
validates_format_of :class_period, :with =>/^[1-9]\d*$/
after_save :create_board_sync
before_destroy :delete_all_members
@ -199,10 +199,12 @@ class Course < ActiveRecord::Base
# 删除课程所有成员
def delete_all_members
if self.members && self.members.count > 0
me, mr = Member.table_name, MemberRole.table_name
connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})")
Member.delete_all(['course_id = ?', id])
end
end
def get_endup_time
begin

View File

@ -97,12 +97,8 @@
</td>
<td>
<strong>项目得分:&nbsp;
<span style="color: #EC6300;">
<% if homework.project != nil %>
<%= project_score homework.project %>
<% else %>
0.00
<% end %>
<span style="color: <%= homework.project.nil? ? "#727272" : "#EC6300"%>;">
<%= homework.project.nil? ? "N/A" : project_score(homework.project) %>
</span>
</strong>
</td>
@ -120,14 +116,17 @@
</td>
<td>
<strong>互评得分:&nbsp;
<span style="color: #EC6300;"><%= student_score_for_homework(homework) %></span>&nbsp;&nbsp;
<% student_homework_score = student_score_for_homework(homework) %>
<span style="color:<%= student_homework_score == "0.00"? "#727272" : "#EC6300"%>;">
<% score = student_homework_score == "0.00"? "N/A" : student_homework_score %>
<%= score %>
</span>&nbsp;&nbsp;
<% if is_evaluation && is_student && (!users_for_homework(homework).include? User.current)%>
<%= link_to "学生互评>>",homework_attach_path(homework) %>
<% end %>
</strong>
</td>
</tr>
<tr>
<td style="vertical-align: top;width: 200px;">
<% if is_evaluation || is_teacher%>
@ -136,7 +135,11 @@
</td>
<td>
<strong>终评得分:&nbsp;
<span style="color: #EC6300;"><%= score_for_homework homework %></span>&nbsp;&nbsp;
<% totle_homework_score = score_for_homework(homework) %>
<span style="color:<%= totle_homework_score == "0.00"? "#727272" : "#EC6300"%> ;">
<% score = totle_homework_score == "0.00"? "N/A" : totle_homework_score %>
<%= score %>
</span>&nbsp;&nbsp;
<% if is_teacher %>
<%= link_to "教师评分>>",homework_attach_path(homework) %>
<% end %>

View File

@ -66,7 +66,6 @@
<tr>
<!-- modified by zjc 课程名称添加超链接 -->
<td class="info-course"><%= link_to @course.name,course_path(@course) %></td>
<td class="info-course"><%= @course.name %></td>
</tr>
<tr>
<td align="center">

View File

@ -38,7 +38,7 @@
<a><%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index' %></a></td>
<td><p class="top-content-list-homework"><%= link_to "主页", home_path %>
> <%= link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> >
<span><%= link_to(@bid.courses.first.name.to_s, homework_course_path(@bid.courses.first)) if @bid.courses.first %></span>
<span><%= link_to(course.name.to_s, homework_course_path(course)) if course %></span>
>
<%= link_to(@bid.name, respond_path(@bid)) %></p></td>
</tr>
@ -65,7 +65,7 @@
<td style="vertical-align: top;font-size: 16px;text-align: center;">
<span style=" word-wrap: break-word; word-break: break-all">
<strong>
<%= link_to @bid.courses.first.name.to_s, homework_course_path(@bid.courses.first) if @bid.courses.first %>
<%= link_to course.name.to_s, homework_course_path(course) if course %>
</strong>
</span>
</td>
@ -211,9 +211,9 @@
<li>
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show'}, :class => link_class(:respond) %>
</li>
<% if User.current.member_of? @bid.courses.first %>
<% if User.current.member_of_course? course %>
<li>
<% if User.current.logged? && @bid.courses.first && (!Member.where('user_id = ? and course_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?', 5, 10, 7)).size >0) %>
<% if User.current.logged? && course && (!Member.where('user_id = ? and course_id = ?', User.current.id, course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, course.id).first.roles&Role.where('id = ? or id = ? or id =?', 5, 10, 7)).size >0) %>
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_course'}, :class => link_class(:course) %>
<% else %>
<%= link_to l(:label_homework_info), {:controller => 'bids', :action => 'show_course'}, :class => link_class(:course) %>
@ -221,9 +221,9 @@
<% end %>
</li>
<% end %>
<!-- <li><%= link_to l(:label_homework_statistics), {:controller => 'bids', :action => 'homework_statistics'}, :class => link_class(:homework_statistics) %></li> -->
<!-- <li><%= link_to l(:label_homework_respond), {:controller => 'bids', :action => 'homework_respond'}, :class => link_class(:homework_respond) %></li>
--></ul>
<!-- <li><%#= link_to l(:label_homework_statistics), {:controller => 'bids', :action => 'homework_statistics'}, :class => link_class(:homework_statistics) %></li> -->
<!-- <li><%#= link_to l(:label_homework_respond), {:controller => 'bids', :action => 'homework_respond'}, :class => link_class(:homework_respond) %></li>-->
</ul>
</div>
<%= yield %>

View File

@ -76,7 +76,7 @@
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title(l(:label_news_plural)) -%>
<% html_title(l(:label_course_news)) -%>
</div>
<script type='text/javascript'>

View File

@ -186,6 +186,7 @@ en:
notice_account_deleted: "Your account has been permanently deleted."
notice_user_successful_create: "User %{id} created."
error_class_period_only_num: "class period can only digital"
error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
error_scm_not_found: "The entry or revision was not found in the repository."
error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"

View File

@ -196,6 +196,7 @@ zh:
error_complete_occupation: "请您填写工作单位,否则本系统的部分功能将无法正常使用。"
error_class_period_only_num: "课程学时只能为数字"
error_can_t_load_default_data: "无法载入默认设置:%{value}"
error_scm_not_found: "版本库中不存在该条目和(或)其修订版本。"
error_scm_command_failed: "访问版本库时发生错误:%{value}"
@ -281,6 +282,7 @@ zh:
field_role: 角色
field_homepage: 主页
field_time: 课时
field_class_period: 学时
field_code: 学分
field_is_public: 公开
field_parent: 上级项目

View File

@ -580,6 +580,7 @@ RedmineApp::Application.routes.draw do
get 'homework', :action => 'homework', :as => 'homework'
get 'new_homework', :action => 'new_homework', :as => 'new_homework'
get 'file', :action => 'file', :as => 'file'
get 'feedback', :action => 'feedback', :as => 'course_feedback'
get 'member', :controller => 'courses', :action => 'member', :as => 'member'
post 'finishcourse'
post 'restartcourse'

View File

@ -0,0 +1,13 @@
# -*coding:utf-8 -*-
class ModifyStudentRoles < ActiveRecord::Migration
def change
# 修改学生权限
# 添加回复讨论区权限
role = Role.find_by_name('学生')
if role
role.permissions.append(:add_messages)
role.save
end
end
end

View File

@ -740,7 +740,7 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
end
create_table "relative_memos", :force => true do |t|
t.integer "osp_id"
t.integer "osp_id", :null => false
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :null => false

View File

@ -105,6 +105,7 @@ module Redmine
if event_type.to_s != 'course_journals_for_messages'
cur_objs = provider.find_events1(event_type, @user, from, to, @options)
end
if cur_objs
cur_objs.each do |cur_obj|
if cur_obj.class == Issue
if cur_obj.project != nil && cur_obj.project.project_status != nil
@ -115,6 +116,7 @@ module Redmine
end
end
end
end
if e.count > options[:limit]
break
end

View File

@ -67,6 +67,16 @@ module Redmine
end
false
end
def redirect_to_course_menu_item(course, name)
item = Redmine::MenuManager.items(:course_menu).detect {|i| i.name.to_s == name.to_s}
if item && User.current.allowed_to?(item.url, course) && (item.condition.nil? || item.condition.call(course))
redirect_to({item.param => course}.merge(item.url))
return true
end
false
end
end
module MenuHelper