Merge branch 'szzh' into develop

This commit is contained in:
z9hang 2015-01-10 14:40:45 +08:00
commit 666facd483
55 changed files with 1071 additions and 739 deletions

1
0)
View File

@ -1 +0,0 @@
终止批处理操作吗(Y/N)? 终止批处理操作吗(Y/N)? 终止批处理操作吗(Y/N)? 终止批处理操作吗(Y/N)?

51
Gemfile
View File

@ -1,5 +1,4 @@
source 'http://ruby.taobao.org'
#source 'http://ruby.sdutlinux.org/'
source 'https://rubygems.org'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
@ -16,42 +15,23 @@ gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
group :development do
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
end
group :test do
gem "shoulda", "~> 3.5.0"
gem "mocha", "~> 1.1.0"
gem 'capybara', '~> 2.4.1'
gem 'nokogiri', '~> 1.6.3'
gem 'factory_girl', '~> 4.4.0'
gem 'selenium-webdriver', '~> 2.42.0'
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
if ENV['PRY']
gem 'pry'
gem 'pry-nav'
end
end
group :development, :test do
gem "guard-rails", '~> 0.5.3'
gem 'spork-testunit', '~> 0.0.8'
gem 'guard-spork', '~> 1.5.1'
gem 'guard-test', '~> 1.0.0'
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
gem 'pry'
gem 'pry-nav'
group :test do
# shoulda的版本做了改动
#gem "shoulda", "~> 3.3.2"
gem "shoulda", "> 3.3.2"
gem "mocha", "~> 0.13.3"
gem 'capybara', '~> 2.0.0'
gem 'nokogiri', '< 1.6.0'
end
@ -73,6 +53,15 @@ group :ldap do
end
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"

View File

@ -19,7 +19,7 @@ class CoursesController < ApplicationController
before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course]
before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create]
before_filter :require_admin, :only => [:copy, :archive, :unarchive, :destroy, :calendar]
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
before_filter :toggleCourse, :only => [:finishcourse, :restartcourse]
before_filter :require_login, :only => [:join, :unjoin]
#before_filter :allow_join, :only => [:join]
@ -500,7 +500,8 @@ class CoursesController < ApplicationController
end
end
def course
def
course
@school_id = params[:school_id]
per_page_option = 10
if @school_id == "0" or @school_id.nil?

View File

@ -0,0 +1,2 @@
class PollAnswerController < ApplicationController
end

View File

@ -0,0 +1,2 @@
class PollController < ApplicationController
end

View File

@ -0,0 +1,2 @@
class PollQuestionController < ApplicationController
end

View File

@ -0,0 +1,2 @@
class PollUserController < ApplicationController
end

View File

@ -0,0 +1,2 @@
class PollVoteController < ApplicationController
end

View File

@ -129,7 +129,7 @@ class UsersController < ApplicationController
end
def show_new_score
render :layout => false
render :layout => 'users_base'
end
# end

View File

@ -62,13 +62,49 @@ class WelcomeController < ApplicationController
@course_page = FirstPage.find_by_page_type('course')
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id)
@logoLink ||= logolink()
##3-8月份为查找春季课程9-2月份为查找秋季课程
#month_now = Time.now.strftime("%m").to_i
#year_now = Time.new.strftime("%Y").to_i
#(month_now >= 3 && month_now < 9) ? course_term = l(:label_spring) : course_term = l(:label_autumn)
##year_now -= 1 if year_now < 3
#@school_id.nil? ? @cur_school_course = [] : @cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term)
##未登录或者当前学校未开设课程
#if @cur_school_course.empty?
# @has_course = false
# User.current.logged? ? course_count = 9 : course_count = 10
# @cur_school_course += find_all_new_hot_course(course_count, @school_id, year_now, course_term)
# while @cur_school_course.count < 9 do
# if course_term == l(:label_spring)
# course_term = l(:label_autumn)
# year_now -= 1
# else
# course_term = l(:label_spring)
# end
# @cur_school_course += find_all_new_hot_course((10-@cur_school_course.count), nil, year_now, course_term)
# end
#else
# if @cur_school_course.count < 9
# @has_course = false
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, @school_id, year_now, course_term)
# if @cur_school_course.count < 9
# if course_term == l(:label_spring)
# course_term = l(:label_autumn)
# year_now -= 1
# else
# course_term = l(:label_spring)
# end
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, nil, year_now, course_term)
# end
# else
# @has_course = true
# end
#end
end
def logolink()
@course_page = FirstPage.find_by_page_type('course')
logo = get_avatar?(@course_page)
def logolink()
@course_page = FirstPage.find_by_page_type('course')
logo = get_avatar?(@course_page)
id = params[:school_id]
logo_link = ""
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)

View File

@ -20,7 +20,7 @@ module CoursesHelper
# 返回教师数量即roles表中定义的Manager
def teacherCount project
searchTeacherAndAssistant(project).count
project.members.count - studentCount(project).to_i
# or
# searchTeacherAndAssistant(project).count
end
@ -114,7 +114,7 @@ module CoursesHelper
# 学生人数计算
# add by nwb
def studentCount course
searchStudent(course).count.to_s#course.student.count
course.student.count.to_s#course.student.count
end
#课程成员数计算

View File

@ -38,7 +38,7 @@ class Course < ActiveRecord::Base
validates_presence_of :password, :term,:name
validates_format_of :class_period, :with =>/^[1-9]\d*$/
validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
validates_length_of :description, :maximum => 10000
before_save :self_validate
after_create :create_board_sync

9
app/models/poll.rb Normal file
View File

@ -0,0 +1,9 @@
class Poll < ActiveRecord::Base
#attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
include Redmine::SafeAttributes
belongs_to :user
has_many :poll_questions, :dependent => :destroy
has_many :poll_users, :dependent => :destroy
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
end

View File

@ -0,0 +1,7 @@
class PollAnswer < ActiveRecord::Base
# attr_accessible :answer_position, :answer_text, :poll_questions_id
include Redmine::SafeAttributes
belongs_to :poll_question
has_many :poll_votes, :dependent => :destroy
end

View File

@ -0,0 +1,8 @@
class PollQuestion < ActiveRecord::Base
# attr_accessible :is_necessary, :polls_id, :question_title, :question_type
include Redmine::SafeAttributes
belongs_to :poll
has_many :poll_answers, :dependent => :destroy
has_many :poll_votes, :dependent => :destroy
end

7
app/models/poll_user.rb Normal file
View File

@ -0,0 +1,7 @@
class PollUser < ActiveRecord::Base
# attr_accessible :poll_id, :user_id
include Redmine::SafeAttributes
belongs_to :poll
belongs_to :user
end

8
app/models/poll_vote.rb Normal file
View File

@ -0,0 +1,8 @@
class PollVote < ActiveRecord::Base
# attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
include Redmine::SafeAttributes
belongs_to :poll_answer
belongs_to :poll_question
belongs_to :user
end

View File

@ -77,6 +77,13 @@ class User < Principal
has_many :homework_attaches, :through => :homework_users
has_many :homework_evaluations
#问卷相关关关系
has_many :poll_users, :dependent => :destroy
has_many :poll_votes, :dependent => :destroy
has_many :poll, :dependent => :destroy #用户创建的问卷
has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #用户已经完成问答的问卷
# end
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
:after_remove => Proc.new {|user, group| group.user_removed(user)}
has_many :changesets, :dependent => :nullify

View File

@ -10,7 +10,7 @@
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2">
<td rowspan="2" valign="bottom">
<% if User.current.logged? %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %>

View File

@ -1,21 +1,21 @@
<script type="text/javascript">
jQuery(document).ready(function () {
var $group_name = $('#group_name')
$group_name.blur(function (event) {
if ($(this).is('#group_name')) {
$.get(
'<%=valid_ajax_course_path%>',
{ valid: "name",
value: this.value },
function (data) {
if (!data.valid) {
alert('<%= l(:label_groupname_repeat) %>');
}
});
}
function check_groupname() {
var $group_name = $('#group_name');
$.get(
'<%=valid_ajax_course_path%>',
{ valid: "name",
value: document.getElementById('group_name').value },
function (data) {
if (!data.valid) {
alert(data.message);
}
});
}
});
});
</script>
<script type=" text/javascript" charset="utf-8">
function validate_groupname(value1) {
@ -48,9 +48,9 @@
}
function validate_add_group() {
value1 = document.getElementById('group_name').value;
validate_groupname(value1);
validate_groupname_null(value1);
check_groupname();
}
</script>
@ -66,7 +66,7 @@
<div class="cl"></div>
<% if @subPage_title == l(:label_student_list) %>
<div class="st_addclass" id = "st_groups">
<%= render :partial => 'groups_name', locals: {:course_groups => @course_groups} %>
<%= render :partial => 'groups_name', :locals => {:course_groups => @course_groups} %>
</div>
<% end %>

View File

@ -13,7 +13,7 @@
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2">
<td rowspan="2" valign="bottom">
<% if User.current.logged?%>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_course, nil, :global => true) %></td>

View File

@ -78,8 +78,8 @@
</span>
&nbsp;&nbsp;作品描述&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<%= f.text_area "description", :class => "w620", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%>
<span id="homework_attach_description_span" style="padding-left: 100px;"></span>
<%= f.text_area "description", :class => "w620", :style=>"width:432px;", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%>
<br/> <span id="homework_attach_description_span" style="padding-left: 100px;"></span>
</p>
<div class="cl"></div>
<p>

View File

@ -41,11 +41,14 @@
</td>
<td rowspan="2" width="250px">
<div class="project-search">
<%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %>
<%= form_tag({:controller => 'bids', :action => 'contest'}, :id => "contest_search_form",:method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'reward_type', @bid.reward_type %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="$('#contest_search_form').submit();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>

View File

@ -2,6 +2,8 @@
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1 %>
<% teacher_num = teacherCount(@course) %>
<% student_num = studentCount(@course) %>
<!DOCTYPE html>
<html lang="en">
<head>
@ -46,9 +48,13 @@
</td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<%= form_tag(:controller => 'courses', :action => 'search', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20, :style => "float:left" %>
<a href="#" onclick="$('#course_search_form').submit();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<%#= submit_tag l(:label_search), :class => "ButtonColor m3p10", :name => nil, :style => "float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" %>
<% end %>
</div>
</td>
@ -120,19 +126,19 @@
<td class="font_index">
<!-- 1 教师; 2 学生0 全部-->
<% if User.current.member_of_course?(@course) %>
<%= link_to "#{teacherCount(@course)}", course_member_path(@course, :role => 1), :course => '1' %>
<%= link_to "#{teacher_num}", course_member_path(@course, :role => 1), :course => '1' %>
<% else %>
<span>
<%= teacherCount(@course)%>
<%= teacher_num %>
</span>
<% end%>
</td>
<td class="font_index">
<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %>
<%= link_to "#{studentCount(@course)}", course_member_path(@course, :role => 2), :course => '1' %>
<%= link_to "#{student_num}", course_member_path(@course, :role => 2), :course => '1' %>
<% else %>
<span>
<%= studentCount(@course)%>
<%= student_num %>
</span>
<% end %>
</td>
@ -141,10 +147,10 @@
</td>
<tr class="font_aram">
<td align="center" width="80px" id="teacherCount">
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@course)) %>
<%= l(:label_x_base_courses_teacher, :count => teacher_num) %>
</td>
<td align="center" width="80px" id="studentCount">
<%= l(:label_x_base_courses_student, :count => studentCount(@course)) %>
<%= l(:label_x_base_courses_student, :count => student_num) %>
</td>
<td align="center" width="80px">
<%= l(:label_x_course_data, :count => files_count) %>

View File

@ -61,14 +61,14 @@
if(regexName1()){$("#contst_search_form").submit();}
}
</script>
<div class="project-search">
<div class="project-search" style="float: left; margin: 0px">
<%= form_tag({controller: 'contests', action: 'index'}, method: :get, :id => "contst_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px" %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px", :style=>"float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
<%= l(:label_search)%>
</a>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />
<span id="contest_name_span_head"></span>
<% end %>
@ -78,8 +78,8 @@
<tr>
<td>
<%=link_to l(:field_homepage), home_path %> >
<a>
<%= l(:label_contest_innovate) %>
<a href="http://<%= Setting.host_contest %>" class="link_other_item">
<%=l(:label_contests_management_platform)%>
</a> >
<span title="<%= @contest.name%>">
<%= link_to h(truncate(@contest.name, length: 20, omission: '...')), show_contest_contest_path(@contest) %>

View File

@ -64,10 +64,10 @@
}
</script>
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();" %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" >
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />

View File

@ -205,7 +205,7 @@
<td align="right">
<%#= submit_tag l(:button_submit), :name => nil ,
:class => "bid_btn" %>
<a href="#" onclick='$("#my_brief_introduction").parent().submit();' class="ButtonColor m3p10" >
<a href="#" onclick='$("#my_brief_introduction").parent().submit();' class="ButtonColor m3p10" style="padding: 5px 10px;" >
<%= l(:label_submit)%>
</a>
</td>
@ -221,16 +221,16 @@
<div class="inf_user_context">
<table style="font-family:'微软雅黑'" width="240">
<tr>
<td style="padding-left: 5px" width="70px">
<%= l(:label_user_joinin) %>
<td style=" float: right" width="70px">
<span style="float: right"> <%= l(:label_user_joinin) %></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= format_time(@user.created_on) %>
</td>
</tr>
<tr>
<td style="padding-left: 5px">
<%= l(:label_user_login) %>
<td style=" float: right" width="70px">
<span style="float: right"> <%= l(:label_user_login) %></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px">
<%= format_time(@user.last_login_on) %>
@ -239,8 +239,8 @@
<% unless @user.user_extensions.nil? %>
<% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %>
<tr>
<td style="padding-left: 5px" width="70px">
<%= l(:field_occupation) %>
<td style=" float: right" width="70px">
<span style="float: right"><%= l(:field_occupation) %></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<% unless @user.user_extensions.school.nil? %>
@ -250,8 +250,8 @@
</tr>
<% elsif @user.user_extensions.identity == 3 %>
<tr>
<td style="padding-left: 5px" width="70px">
<%= l(:field_occupation) %>
<td style=" float: right" width="70px">
<span style="float: right"> <%= l(:field_occupation) %></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.occupation %>
@ -259,8 +259,8 @@
</tr>
<% elsif @user.user_extensions.identity == 2 %>
<tr>
<td style="padding-left: 18px" width="70px">
<%= l(:label_company_name) %>
<td style=" float: right" width="70px">
<span style="float: right"> <%= l(:label_company_name) %></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.firstname %>
@ -268,8 +268,8 @@
</tr>
<% end %>
<tr>
<td style="padding-left: 31px" width="76px">
<%= l(:label_location) %>
<td style=" float: right" width="70px">
<span style="float: right"> <%= l(:label_location) %></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.location %>
@ -278,8 +278,8 @@
</tr>
<tr>
<% if @user.user_extensions.identity == 0 %>
<td style="padding-left: 31px" width="76px" >
<%= l(:label_technical_title) %>
<td style=" float: right" width="70px" >
<span style="float: right"> <%= l(:label_technical_title) %></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<span id = "td_tech_title"></span>
@ -289,8 +289,8 @@
<% if @user.user_extensions.identity == 1 %>
<% if(is_watching?(@user) ) %>
<tr>
<td style="padding-left: 31px" width="70px" >
<%= l(:label_bidding_user_studentcode)%>
<td style=" float: right" width="70px" >
<span style="float: right"> <%= l(:label_bidding_user_studentcode)%></span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.student_id %>
@ -298,7 +298,7 @@
</tr>
<% else %>
<tr>
<td style="padding-left: 31px" width="70px" >
<td style=" float: right" width="70px" >
<%= l(:label_identity)%>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
@ -309,7 +309,7 @@
<% end %>
<% elsif @user.user_extensions.identity == 3 %>
<tr>
<td style="padding-left: 31px" width="70px" >
<td style=" float: right" width="70px" >
<%= l(:label_identity)%>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">

View File

@ -1,7 +1,7 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
@nav_dispaly_user_label = 1
@nav_dispaly_store_all_label = 1
%>
<% @nav_dispaly_forum_label = 1%>
<!DOCTYPE html>
<html lang="<%= current_language %>">
@ -39,12 +39,12 @@
</div>
</div>
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
<div id="ajax-indicator" ><span><%= l(:label_loading) %></span></div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<!--<#%= call_hook :view_layouts_base_body_bottom %>-->
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -10,7 +10,7 @@
<tr>
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_course_practice) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2">
<td rowspan="2" valign="bottom">
<% if User.current.logged?%>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
@ -35,7 +35,7 @@
<tr>
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_project_deposit) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2">
<td rowspan="2" valign="bottom">
<% if User.current.logged? %>
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
<% end %>

View File

@ -77,10 +77,10 @@
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<!--<%#= f.submit l(:button_project_tags_add),:class => "ButtonColor m3p10" %>-->
<a href="#" onclick='$("#tags_name").parent().submit();' class="ButtonColor m3p10" >
<a href="#" onclick='$("#tags_name").parent().submit();' class="ButtonColor m3p10" style="padding: 3px 6px">
<%= l(:button_project_tags_add)%>
</a>
<%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10'%>
<%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10' ,:style=>"padding:3px 6px"%>
<% end %>
</div>
<% end %>

View File

@ -1,5 +1,5 @@
<div class="clearfix"></div>
<div class="linkother">
<div class="linkother" style="margin-left: 30%; float: left">
<a href="http://<%= Setting.host_name%>" class="link_other_item"><%=l(:label_projects_management_platform)%></a>
<a href="http://<%= Setting.host_course%>" class="link_other_item"><%=l(:label_courses_management_platform)%></a>
<a href="http://<%= Setting.host_contest%>" class="link_other_item"><%=l(:label_contests_management_platform)%></a>

View File

@ -49,10 +49,10 @@ form #search_type{
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<div class="project-search" style="float: right">
<div class='search_widget'>
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27 %>
<%= select_tag(:search_type, options_for_select(select_option) ) %>
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27, %>
<%= select_tag(:search_type, options_for_select(select_option), :style => "float:right" ) %>
</div>
<%#= hidden_field_tag 'project_type', project_type %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil, :style => "float:right" %>
</div>
<% end %>

View File

@ -29,7 +29,7 @@ form #search_type{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
border-left: 1px outset #83A9A9;
margin-left: -4px;
margin-left: 0px;
-webkit-appearance: none;
-moz-appearance: none;
text-indent: 0.01px;
@ -45,7 +45,7 @@ form #search_by
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
border-left: 1px outset #83A9A9;
margin-left: -6px;
margin-left: 0px;
-webkit-appearance: none;
-moz-appearance: none;
text-indent: 0.01px;
@ -87,13 +87,14 @@ form #search_by
</script>
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<div class="project-search" style="float: right">
<div class='search_widget'>
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27 %>
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();" ) %>
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]]), :onchange => "searchByChange();" ) %>
<div class='search_widget' >
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字' %>
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]]), :onchange => "searchByChange();",:style => "float:right" ) %>
</div>
<%#= hidden_field_tag 'project_type', project_type %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil,:style =>"float: right; margin-left:3px;margin-top:2px" %>
</div>
<% end %>

View File

@ -119,6 +119,7 @@
}
})();
</script>
<div>
<div class='top_bar'>
<%#= render partial: 'wei_xin' %>
<div class="main-content-bar" id="main-content-bar">
@ -324,6 +325,7 @@
<div class="clearfix"></div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -90,9 +90,16 @@
</h3>
<% month_now = Time.now.strftime("%m").to_i %>
<% year_now = Time.new.strftime("%Y") %>
<% year_now = Time.new.strftime("%Y").to_i %>
<!-- 3-8月份为查找春季课程9-2月份为查找秋季课程 -->
<% (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %>
<% if month_now < 3
year_now -= 1
course_term = "秋季学期"
elsif month_now < 9
course_term = "秋季学期"
end
%>
<%# (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %>
<% @school_id.nil? ? cur_school_course = [] : cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) %>
<% if cur_school_course.count == 0 %>
@ -107,7 +114,17 @@
</li>
<% end %>
<% User.current.logged? ? course_count = 9 : course_count = 10 %>
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(course_count, @school_id, year_now, course_term)} %>
<% all_new_hot_course = find_all_new_hot_course(course_count, @school_id, year_now, course_term)%>
<% while all_new_hot_course.count < course_count%>
<% if course_term == "春季学期"
year_now -= 1
course_term = "秋季学期"
else
course_term = "春季学期"
end%>
<% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%>
<% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
</ul>
</div>
<% else %>
@ -127,7 +144,17 @@
<li>
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
</li>
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)} %>
<% all_new_hot_course = find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)%>
<% while (all_new_hot_course.count + cur_school_course.count) < 9%>
<% if course_term == "春季学期"
year_now -= 1
course_term = "秋季学期"
else
course_term = "春季学期"
end%>
<% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%>
<% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% end %>
</ul>
</div>

View File

@ -71,7 +71,7 @@
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% @projects.map do |project| %>
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<li style="overflow:hidden;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</div>

View File

@ -0,0 +1,52 @@
# Default setup is given for MySQL with ruby1.9. If you're running Redmine
# with MySQL and ruby1.8, replace the adapter name with `mysql`.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).
production:
adapter: mysql2
database: redmine
host: localhost
username: root
password: ""
encoding: utf8
development:
adapter: mysql2
database: redmine_development
host: 10.107.17.20
username: root
password: "1234"
encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
database: redmine_test
host: 10.107.17.20
username: root
password: "1234"
encoding: utf8
# PostgreSQL configuration example
#production:
# adapter: postgresql
# database: redmine
# host: localhost
# username: postgres
# password: "postgres"
# SQLite3 configuration example
#production:
# adapter: sqlite3
# database: db/redmine.sqlite3
# SQL Server configuration example
#production:
# adapter: sqlserver
# database: redmine
# host: localhost
# username: jenkins
# password: jenkins

View File

@ -2179,7 +2179,7 @@ zh:
modal_valid_passing: 可以使用
label_bug: 漏洞
label_school_no_course: 该学校未开设任何课程,您可以查看其他学校课程
label_school_no_course: 该学校本学期未开设任何课程,您可以查看其他学校课程
label_school_less_course: 您也可以查看其他学校课程
label_file_not_found: 对不起,该文件现在不能下载

View File

@ -0,0 +1,19 @@
class CreatePolls < ActiveRecord::Migration
def up
create_table :polls do |t|
t.string :polls_name
t.string :polls_type
t.integer :polls_group_id
t.integer :polls_status
t.integer :user_id
t.datetime :published_at
t.datetime :closed_at
t.timestamps
end
end
def down
drop_table :polls
end
end

View File

@ -0,0 +1,16 @@
class CreatePollQuestions < ActiveRecord::Migration
def up
create_table :poll_questions do |t|
t.string :question_title
t.integer :question_type
t.integer :is_necessary
t.integer :poll_id
t.timestamps
end
end
def down
drop_table :poll_questions
end
end

View File

@ -0,0 +1,15 @@
class CreatePollAnswers < ActiveRecord::Migration
def up
create_table :poll_answers do |t|
t.integer :poll_question_id
t.text :answer_text
t.integer :answer_position
t.timestamps
end
end
def down
drop_table :poll_answers
end
end

View File

@ -0,0 +1,16 @@
class CreatePollVotes < ActiveRecord::Migration
def up
create_table :poll_votes do |t|
t.integer :user_id
t.integer :poll_question_id
t.integer :poll_answer_id
t.text :vote_text
t.timestamps
end
end
def down
drop_table :poll_votes
end
end

View File

@ -0,0 +1,14 @@
class CreatePollUsers < ActiveRecord::Migration
def up
create_table :poll_users do |t|
t.integer :user_id
t.integer :poll_id
t.timestamps
end
end
def down
drop_table :poll_users
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20141231085350) do
ActiveRecord::Schema.define(:version => 20150108035338) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -790,6 +790,51 @@ ActiveRecord::Schema.define(:version => 20141231085350) do
t.integer "project_id"
end
create_table "poll_answers", :force => true do |t|
t.integer "poll_question_id"
t.text "answer_text"
t.integer "answer_position"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "poll_questions", :force => true do |t|
t.string "question_title"
t.integer "question_type"
t.integer "is_necessary"
t.integer "poll_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "poll_users", :force => true do |t|
t.integer "user_id"
t.integer "poll_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "poll_votes", :force => true do |t|
t.integer "user_id"
t.integer "poll_question_id"
t.integer "poll_answer_id"
t.text "vote_text"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "polls", :force => true do |t|
t.string "polls_name"
t.string "polls_type"
t.integer "polls_group_id"
t.integer "polls_status"
t.integer "user_id"
t.datetime "published_at"
t.datetime "closed_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "praise_tread_caches", :force => true do |t|
t.integer "object_id", :null => false
t.string "object_type"

View File

@ -2911,8 +2911,8 @@ input[class~='ButtonClolr'],.ButtonColor{
}
input[class~='m3p10'], .m3p10 {
margin: 0;
padding: 3px 10px !important;
margin-top: 5px;
padding: 5px 10px;
height: 20px;
display: inline-block;
color: #ffffff;

View File

@ -149,7 +149,7 @@ a:hover.tijiao{ background:#0f99a9 !important;}
.ni_con p{ color:#808181;}
.ni_con a:hover{ text-decoration:none;}
.ui-widget-header{display: none;}

View File

@ -2,7 +2,7 @@
padding-left: 0px;
}
.jstEditor textarea, .jstEditor iframe {
margin: 0;
margin: 0 !important;
}
.jstHandle {
@ -13,7 +13,7 @@
}
.jstElements {
padding: 3px 3px 3px 10px;/*by young*/
padding: 3px 3px 3px 0px;/*by young*/
}
.jstElements button {

View File

@ -0,0 +1,7 @@
require 'test_helper'
class PollAnswersTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class PollQuestionsTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class PollUserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class PollVotesTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

7
test/unit/polls_test.rb Normal file
View File

@ -0,0 +1,7 @@
require 'test_helper'
class PollsTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end