This commit is contained in:
z9hang 2014-07-29 18:04:45 +08:00
commit 952fcce0de
23 changed files with 265 additions and 326 deletions

View File

@ -181,7 +181,8 @@ class AttachmentsController < ApplicationController
respond_to do |format| respond_to do |format|
# modify by nwb # modify by nwb
if !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) &&(@attachment.container.is_a?(Course) || @attachment.container.course) if !@attachment.container.nil? &&
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course ) )
if @attachment.container.is_a?(News) if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) } format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @course.nil? elsif @course.nil?

View File

@ -85,7 +85,7 @@ class MessagesController < ApplicationController
@reply.board = @board @reply.board = @board
@reply.safe_attributes = params[:reply] @reply.safe_attributes = params[:reply]
@topic.children << @reply @topic.children << @reply
@topic.update_attribute(:updated_on, Time.now) #@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record? if !@reply.new_record?
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments]) attachments = Attachment.attach_files(@reply, params[:attachments])

View File

@ -304,6 +304,36 @@ class SoftapplicationsController < ApplicationController
end end
end end
def search
@softapplications = Softapplication.where("name like '%#{params[:name]}%'")
#new added fenyefunction
@limit = 5
@softapplication_count = @softapplications.count
@softapplication_pages = Paginator.new @softapplication_count, @limit, params['page']
@offset ||= @softapplication_pages.offset
#new added sort
if params[:softapplication_sort_type].present?
case params[:softapplication_sort_type]
when '0'
@softapplications = @softapplications[@offset, @limit]
@s_state = 0
when '1'
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
else
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
#new added end
respond_to do |format|
format.html
end
end
private private
def find_softapplication def find_softapplication
@softapplication = Softapplication.find_by_id(params[:id]) @softapplication = Softapplication.find_by_id(params[:id])

View File

@ -167,12 +167,6 @@ class Mailer < ActionMailer::Base
#缺陷到期邮件通知 #缺陷到期邮件通知
def issue_expire issue def issue_expire issue
#@issues = issues
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
#puts s + "////" + issue.assigned_to.mail
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
#mail :to => issue.assigned_to.mail,
# :subject => s
issue_id = issue.project_index issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier, redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue_id, 'Issue-Id' => issue_id,
@ -183,10 +177,32 @@ class Mailer < ActionMailer::Base
@issue = issue @issue = issue
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
recipients = issue.recipients recipients = issue.recipients
cc = issue.watcher_recipients - recipients s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
mail :to => recipients, mail :to => recipients,
:cc => cc, :subject => s
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" #########################################################################################################
#@issues = issues
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
#puts s + "////" + issue.assigned_to.mail
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
#mail :to => issue.assigned_to.mail,
# :subject => s
#########################################################################################################
#issue_id = issue.project_index
#redmine_headers 'Project' => issue.project.identifier,
# 'Issue-Id' => issue_id,
# 'Issue-Author' => issue.author.login
#redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
#message_id issue
#@author = issue.author
#@issue = issue
#@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
#recipients = issue.recipients
#cc = issue.watcher_recipients - recipients
#mail :to => recipients,
# :cc => cc,
# :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
######################################################################################################
end end
@ -567,9 +583,10 @@ class Mailer < ActionMailer::Base
end end
#缺陷到期后发送邮件提示 #缺陷到期后发送邮件提示
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
def mail_issue def mail_issue
threads = [] threads = []
issues = Issue.where("done_ratio <> 100 && closed_on is null && due_date is not null") issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null and due_date > '#{Time.now.to_date}'")
issues.each do |issue| issues.each do |issue|
thread = Thread.start do thread = Thread.start do
while true while true
@ -582,7 +599,7 @@ class Mailer < ActionMailer::Base
sleep 3600 sleep 3600
else else
#发邮件 #发邮件
puts issue.id.to_s #puts issue.id.to_s
Mailer.issue_expire(issue).deliver Mailer.issue_expire(issue).deliver
#Mailer.issue_add(issue).deliver #Mailer.issue_add(issue).deliver
break break
@ -591,7 +608,6 @@ class Mailer < ActionMailer::Base
end end
threads << thread threads << thread
end end
puts threads.count.to_s
threads threads
end end

View File

@ -1,6 +1,6 @@
<div id="admin-index"> <div id="admin-index">
<h3><%=l(:label_administration)%></h3> <h3><%=l(:label_administration)%></h3>
<!-- <%= render :partial => 'no_data' if @no_configuration_data %> --> <!-- <%#= render :partial => 'no_data' if @no_configuration_data %> -->
<%= render :partial => 'menu' %> <%= render :partial => 'menu' %>
</div> </div>

View File

@ -1,21 +1,36 @@
<script type="text/javascript">
function searchUser(){
var name = $("#name").val();
if(name == "")
{
alert("搜索条件不能为空");
return;
}
$("#search_softapplications").submit();
}
</script>
<div class="top-content"> <div class="top-content">
<table> <table>
<tr> <tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%=l(:label_contest_innovate_community)%></td> <td class="info_font" style="width: 240px; color: #15bccf"><%=l(:label_contest_innovate_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td> <td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="305px"> <td rowspan="2" width="305px">
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 25 %> <%= form_tag({:controller => 'softapplications', :action => 'search'}, :method => :get, :id => "search_softapplications") do %>
<%= hidden_field_tag 'project_type', params[:project_type] %> <%= text_field_tag 'name', params[:name], :size => 25 %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%= hidden_field_tag 'project_type', params[:project_type] %>
</div> <input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/softapplications", :controller=>'softapplications', :action=>'index' %></td> <td style="padding-left: 8px"><%=link_to request.host()+"/softapplications", :controller=>'softapplications', :action=>'index' %></td>
<td ><%=link_to l(:field_homepage), home_path %> > <td ><%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %> <%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -0,0 +1,24 @@
<% @softapplications.each do |softapplication| %>
<div>
<span style="font-size: 15px; margin-right: 10px;"><strong><%= link_to softapplication.name, softapplication, :target => "_blank" %></strong></span>
<span><%= rating_for softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></span>
</div>
<div class="avatar-4" style="float: left; margin-top: 7px "><%= image_tag('/images/app1.png')%></div>
<div style="float: left; width: 600px; padding-top: 6px; margin-left: 8px"><%= softapplication.description.truncate(95, omission: '...') %></div>
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; line-height: 0.5em ">
<%contest = softapplication.contests.first%>
<p><%=l(:label_attendingcontestwork_belongs_contest)%><%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%></p>
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name.truncate(10, omission: '...') %></p>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><%= softapplication.android_min_version_available %></p>
</div>
<div style="padding-left: 53px">
<span><%=l(:label_attendingcontestwork_developers)%><%= softapplication.application_developers %></span>
<span style="padding-left: 50px"><%=l(:label_attendingcontestwork_release_time)%><%=format_time softapplication.created_at %></span>
</div>
<div style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; margin-left: 50px; padding-bottom: 10px; margin-bottom: 20px; width: 66%"></div>
<div class="underline-contests_one" style="margin-top: -7px"></div>
<% end %>
<div class="pagination"><%= pagination_links_full @softapplication_pages, @softapplication_count, :per_page_links => false %></div>

View File

@ -3,37 +3,15 @@
<%=render :partial => 'layouts/base_softapplication_index_top_content'%> <%=render :partial => 'layouts/base_softapplication_index_top_content'%>
<% if @softapplications.size > 0%> <% if @softapplications.size > 0%>
<%= sort_softapplication(@s_state)%> <div width="95%" border="0" style="padding-left: 10px; padding-top: 10px;" id="softapplications_list">
<%= sort_softapplication(@s_state)%>
<div width="95%" border="0" style="padding-left: 10px; padding-top: 10px;"> <%= render :partial => "list" %>
<% @softapplications.each do |softapplication| %>
<div>
<span style="font-size: 15px; margin-right: 10px;"><strong><%= link_to softapplication.name, softapplication, :target => "_blank" %></strong></span>
<span><%= rating_for softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></span>
</div>
<div class="avatar-4"; style="float: left; margin-top: 7px "><%= image_tag('/images/app1.png')%></div>
<div style="float: left; width: 600px; padding-top: 6px; margin-left: 8px"><%= softapplication.description.truncate(95, omission: '...') %></div>
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; line-height: 0.5em ">
<%contest = softapplication.contests.first%>
<p><%=l(:label_attendingcontestwork_belongs_contest)%><%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%></p>
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name.truncate(10, omission: '...') %></p>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><%= softapplication.android_min_version_available %></p>
</div>
<div style="padding-left: 53px">
<span><%=l(:label_attendingcontestwork_developers)%><%= softapplication.application_developers %></span>
<span style="padding-left: 50px"><%=l(:label_attendingcontestwork_release_time)%><%=format_time softapplication.created_at %></span>
</div>
<div style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; margin-left: 50px; padding-bottom: 10px; margin-bottom: 20px; width: 66%"></div>
<div class="underline-contests_one" style="margin-top: -7px"></div>
<% end %>
</div> </div>
<% else %> <% else %>
<%= render :partial => "layouts/no_content"%> <%= render :partial => "layouts/no_content"%>
<% end %> <% end %>
<div class="pagination"><%= pagination_links_full @softapplication_pages, @softapplication_count, :per_page_links => false %></div>
<% html_title l(:label_contest_work_list)%> <% html_title l(:label_contest_work_list)%>

View File

@ -0,0 +1,11 @@
<%=render :partial => 'layouts/base_softapplication_index_top_content'%>
<% if @softapplications.size > 0%>
<%#= sort_softapplication(@s_state)%>
<div width="95%" border="0" style="padding-left: 10px; padding-top: 10px;" id="softapplications_list">
<%= render :partial => "list" %>
</div>
<% else %>
<%= render :partial => "layouts/no_content"%>
<% end %>
<% html_title l(:label_contest_work_list)%>

View File

@ -0,0 +1,2 @@
$('#softapplications_list').html('<%= escape_javascript(render(:partial => 'list' )) %>');

View File

@ -87,12 +87,12 @@ default:
address: smtp.gmail.com address: smtp.qq.com
port: 587 port: 587
domain: smtp.gmail.com domain: smtp.qq.com
authentication: :plain authentication: :plain
user_name: trustieforge@gmail.com user_name: 939547590@qq.com
password: '!@#$%^&*(' password: 'suwen11223344'
# Absolute path to the directory where attachments are stored. # Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance. # The default is the 'files' directory in your Redmine instance.

View File

@ -1,4 +1,4 @@
#Mailer.mail_issue.each do |t| Mailer.mail_issue.each do |t|
# t.join t.join
#end end

View File

@ -76,6 +76,7 @@ RedmineApp::Application.routes.draw do
collection do collection do
match 'new_message', via: :get match 'new_message', via: :get
match 'search', via: [:get, :post]
end end
member do member do
match 'create_message' , via: :post match 'create_message' , via: :post

View File

@ -439,26 +439,6 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "gitlab_projects", :force => true do |t|
t.integer "gitlab_project_id"
t.integer "project_id"
t.string "repository_url"
t.string "web_url"
t.string "localfile_url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "gitlab_users", :force => true do |t|
t.integer "gitlab_user_id"
t.integer "user_id"
t.string "email"
t.string "password"
t.string "login", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups_users", :id => false, :force => true do |t| create_table "groups_users", :id => false, :force => true do |t|
t.integer "group_id", :null => false t.integer "group_id", :null => false
t.integer "user_id", :null => false t.integer "user_id", :null => false
@ -901,6 +881,19 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "rich_file_file_name"
t.string "rich_file_content_type"
t.integer "rich_file_file_size"
t.datetime "rich_file_updated_at"
t.string "owner_type"
t.integer "owner_id"
t.text "uri_cache"
t.string "simplified_type", :default => "file"
end
create_table "roles", :force => true do |t| create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1 t.integer "position", :default => 1

View File

@ -1,9 +1,15 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one: courses_001_infos:
typeId: 1 id: 1
typeName: MyString course_id: 1
user_id: 20
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
courses_002_infos:
id: 2
course_id: 2
user_id: 20
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
two:
typeId: 1
typeName: MyString

View File

@ -1,15 +1,18 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
courses_001_statuses:
one:
changesets_count: 1 changesets_count: 1
watchers_count: 1 watchers_count: 1
course_id: 1 course_id: 1
grade: 1.5 grade: 1.5
course_ac_para: 1 course_ac_para: 1
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41
two: courses_002_statuses:
changesets_count: 1 changesets_count: 1
watchers_count: 1 watchers_count: 1
course_id: 1 course_id: 2
grade: 1.5 grade: 1.5
course_ac_para: 1 course_ac_para: 1
created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41

View File

@ -1,23 +1,23 @@
--- ---
courses_invalid_001: courses_001:
id: 1 id: 1
tea_id: tea_id: 20
name: '' name: courses_001
state: state:
code: code:
time: time: 2013
extra: extra:
created_at: 2013-09-30 15:36:00.000000000 Z created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41.000000000 Z updated_at: 2014-04-19 01:50:41
location: location:
term: term: 春季学期
string: string:
password: password: '1234'
setup_time: setup_time:
endup_time: endup_time: '2014-04-18 00:00:00'
class_period: class_period: '32'
school_id: school_id: 117
description: description: 'courses_001 description'
status: 1 status: 1
attachmenttype: 2 attachmenttype: 2
lft: lft:
@ -25,16 +25,16 @@ courses_invalid_001:
is_public: 1 is_public: 1
inherit_members: 1 inherit_members: 1
courses_008: courses_002:
id: 8 id: 2
tea_id: 5 tea_id: 20
name: 分布式计算环境 name: 分布式计算环境
state: state:
code: code:
time: 2013 time: 2013
extra: course2013-09-30_23-36-00 extra: course2013-09-30_23-36-00
created_at: 2013-09-30 15:36:00.000000000 Z created_at: 2013-09-30 15:36:00
updated_at: 2014-04-19 01:50:41.000000000 Z updated_at: 2014-04-19 01:50:41
location: location:
term: 春季学期 term: 春季学期
string: string:
@ -50,129 +50,3 @@ courses_008:
rgt: rgt:
is_public: 1 is_public: 1
inherit_members: 1 inherit_members: 1
courses_058:
id: 58
tea_id: 1168
name: 软件工程实践
state:
code:
time: 2014
extra: course2014-04-17_17-12-17
created_at: 2014-04-17 09:12:17.000000000 Z
updated_at: 2014-04-17 09:12:17.000000000 Z
location:
term: 春季学期
string:
password: SEP2014
setup_time:
endup_time:
class_period: '18'
school_id: 0
description: 国防科技大学计算机学院工程硕士专业选修课。
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1
courses_059:
id: 59
tea_id: 193
name: 软件项目管理
state:
code:
time: 2014
extra: course2014-04-18_18-10-46
created_at: 2014-04-18 10:10:46.000000000 Z
updated_at: 2014-04-18 10:10:46.000000000 Z
location:
term: 春季学期
string:
password: software
setup_time:
endup_time:
class_period: '30'
school_id: 0
description: 面向“软件工程”专业的本科生
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1
courses_060:
id: 60
tea_id: 1179
name: android开发
state:
code:
time: 2014
extra: course2014-04-19_15-40-39
created_at: 2014-04-19 07:40:39.000000000 Z
updated_at: 2014-04-19 07:40:39.000000000 Z
location:
term: 春季学期
string:
password: trustie740208
setup_time:
endup_time:
class_period: '48'
school_id: 37
description: ''
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1
courses_061:
id: 61
tea_id: 29
name: 测试课程1
state:
code:
time: 2014
extra: course2014-06-04_14-51-56
created_at: 2014-06-04 06:51:56.000000000 Z
updated_at: 2014-07-15 01:40:49.000000000 Z
location:
term: 春季学期
string:
password: '1234'
setup_time:
endup_time: '2014-07-14 00:00:00'
class_period: '23'
school_id: 1579
description: '233'
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 0
inherit_members: 1
course_trustie_074:
id: 74
tea_id: 698
name: 电路与电子学基础(软件工程专业)
state:
code:
time: 2014
extra: course2014-05-22_16-09-25
created_at: 2014-05-22 08:09:25.000000000 Z
updated_at: 2014-05-22 08:09:25.000000000 Z
location:
term: 春季学期
string:
password: '12345678'
setup_time:
endup_time:
class_period: '54'
school_id: 117
description: "电路与电子学基础,软件工程小班\\r\ 模拟电子技术部分\ "
status: 1
attachmenttype: 2
lft:
rgt:
is_public: 1
inherit_members: 1

View File

@ -47,8 +47,3 @@ member_roles_011:
role_id: 2 role_id: 2
member_id: 10 member_id: 10
inherited_from: 10 inherited_from: 10
member_roles_179:
id: 179
member_id: 126
role_id: 3
inherited_from:

View File

@ -60,10 +60,3 @@ members_010:
project_id: 2 project_id: 2
user_id: 8 user_id: 8
mail_notification: false mail_notification: false
members_course_001:
id: 126
user_id: 5
project_id: -1
created_on: 2013-09-30 15:36:00.000000000 Z
mail_notification: false
course_id: 8

View File

@ -1,9 +1,13 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one: school_117:
name: id: 117
province: MyString name: 国防科学技术大学
province: 湖南省
logo_link:
two: school_001:
name: id: 1
province: MyString name: 摧毁地球人学校
province: 火星
logo_link:

View File

@ -1,76 +1,57 @@
person_one_extra: user_extension_006:
id: 44 id: 6
user_id: 29 user_id: 6
birthday: "2013-09-30 21:19:25"
brief_introduction: nil
gender: 1
location: "江苏"
occupation: ""
work_experience: nil
zip_code: nil
created_at: "2013-09-30 21:19:25"
updated_at: "2013-10-09 19:00:06"
technical_title: nil
identity: 2
student_id: nil
teacher_realname: nil
student_realname: nil
location_city: "南京"
person_mao_extra:
id: 22
user_id: 193
birthday: "2013-09-30 21:19:25"
brief_introduction: "期待..."
gender: 0
location: "湖南长沙"
occupation: "国防科技大学计算机学院"
work_experience: nil
zip_code: nil
created_at: "2013-09-30 21:19:25"
updated_at: "2013-10-09 19:00:06"
technical_title: "教授"
identity: 0
student_id: nil
teacher_realname: nil
student_realname: nil
location_city: nil
ue_lirongzhen:
id: 587
user_id: 642
birthday: birthday:
brief_introduction: brief_introduction:
gender: 0 gender: 0
location: 河南 location:
occupation:
work_experience:
zip_code:
created_at: 2014-07-29 02:54:09
updated_at: 2014-07-29 02:54:09
technical_title:
identity: 0
student_id:
teacher_realname:
student_realname:
location_city:
school_id:
user_extension_020:
id: 20
user_id: 20
birthday:
brief_introduction: 哈尔
gender: 0
location: 黑龙江
occupation: kylinos-cloud occupation: kylinos-cloud
work_experience: work_experience:
zip_code: zip_code:
created_at: 2014-03-18 14:52:55.000000000 Z created_at: 2014-07-29 02:54:09
updated_at: 2014-03-26 07:19:04.000000000 Z updated_at: 2014-07-29 02:54:09
technical_title: technical_title: 助教
identity: 1 identity: 0
student_id: '14066023' student_id:
teacher_realname: teacher_realname:
student_realname: student_realname:
location_city: 周口 location_city: 哈尔滨
school_id: school_id:
ue_yingang: user_extension_025:
id: 6 id: 25
user_id: 5 user_id: 25
birthday: birthday:
brief_introduction: 现有功能的精细化! brief_introduction: 哈尔
gender: 0 gender: 0
location: 湖南 location: 黑龙江
occupation: 国防科学技术大学计算机学院 occupation: kylinos-cloud
work_experience: work_experience:
zip_code: zip_code:
created_at: 2013-09-24 09:36:12.000000000 Z created_at: 2014-07-29 02:54:09
updated_at: 2014-04-19 08:16:55.000000000 Z updated_at: 2014-07-29 02:54:09
technical_title: 副教授 technical_title: 助教
identity: 0 identity: 1 #student
student_id: '' student_id: 10060342
teacher_realname: teacher_realname:
student_realname: student_realname: 'ue_realname'
location_city: 长沙 location_city: 哈尔滨
school_id: 117 school_id: 117

View File

@ -72,7 +72,7 @@ users_003:
login: dlopper login: dlopper
type: User type: User
users_005: users_005:
id: 12 id: 5
created_on: 2006-07-19 19:33:19 +02:00 created_on: 2006-07-19 19:33:19 +02:00
# Locked # Locked
status: 3 status: 3
@ -165,26 +165,27 @@ groups_011:
id: 11 id: 11
lastname: B Team lastname: B Team
type: Group type: Group
users_yingang_teacher: users_020:
id: 5 id: 20
login: jacknudt login: teacher1
hashed_password: dbbd96684c9a64afe9c4935ce0b517e5e9c08064 # password: foobar
firstname: hashed_password: 6b6095d977621a3071ae2670be95b88092e94b53
lastname: firstname: wang
mail: jack_nudt@163.com lastname: dr
mail: jack_nudt@foo.bar
admin: false admin: false
status: 1 status: 1
last_login_on: 2014-04-27 13:49:18.000000000 Z last_login_on: 2014-07-29 02:54:09
language: zh language: zh
auth_source_id: auth_source_id:
created_on: 2013-06-25 05:20:59.000000000 Z created_on: 2014-07-29 02:54:09
updated_on: 2014-07-16 03:37:51.000000000 Z updated_on: 2014-07-29 02:54:09
type: User type: User
identity_url: identity_url:
mail_notification: only_my_events mail_notification: only_my_events
salt: 92944df2ce4dae1a4f01007263c5d8bb salt: 9db798ee4c462d9614479e6738790891
users_lirongzhen_student: users_025:
id: 642 id: 25
login: lirongzhen login: lirongzhen
hashed_password: 070922b015398577c3ae0d87a68d5ffa93bf82e9 hashed_password: 070922b015398577c3ae0d87a68d5ffa93bf82e9
firstname: 荣振 firstname: 荣振

View File

@ -1,7 +1,18 @@
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)
class CoursesControllerTest < ActionController::TestCase class CoursesControllerTest < ActionController::TestCase
fixtures :courses, :users, :user_extensions, :roles, :members, :member_roles, :enabled_modules, :boards, :messages fixtures :courses,
:course_infos,
:course_statuses,
:users,
:user_extensions,
:schools,
:roles,
:members,
:member_roles,
:enabled_modules,
:boards,
:messages
def setup def setup
@request.session[:user_id] = nil @request.session[:user_id] = nil
@ -23,7 +34,7 @@ class CoursesControllerTest < ActionController::TestCase
# Get :new # Get :new
# 人员添加课程的权限是不属于任何角色 # 人员添加课程的权限是不属于任何角色
def test_new_course_anyone_temporary def test_new_course_anyone_temporary
@request.session[:user_id] = 5 @request.session[:user_id] = 20
Role.find_by_name("Non member").add_permission! :add_course #Non member Role.find_by_name("Non member").add_permission! :add_course #Non member
get :new get :new
@ -33,7 +44,7 @@ class CoursesControllerTest < ActionController::TestCase
# post :create # post :create
def test_create_course_with_access_control def test_create_course_with_access_control
@request.session[:user_id] = 5 @request.session[:user_id] = 20
Role.find_by_name("Non member").add_permission! :add_course #Non member Role.find_by_name("Non member").add_permission! :add_course #Non member
course_name = 'course_one' course_name = 'course_one'
@ -59,7 +70,7 @@ class CoursesControllerTest < ActionController::TestCase
# post :create 403 # post :create 403
def test_create_course_without_access_control def test_create_course_without_access_control
@request.session[:user_id] = 5 @request.session[:user_id] = 20
#Role.find_by_name("Non member").add_permission! :add_course #Non member #Role.find_by_name("Non member").add_permission! :add_course #Non member
course_name = 'course_one' course_name = 'course_one'